Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
Make menu cache lookup run quite early, props @Biont.
Browse files Browse the repository at this point in the history
  • Loading branch information
tfrommen committed Jul 11, 2017
1 parent 7e57218 commit 8089e70
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ function bootstrap() {

$cache = new MenuCache();

add_filter( 'pre_wp_nav_menu', [ $cache, 'get_menu' ], 10, 2 );
// Cache lookup should happen quite early as potential other code hooked here will somehow conflict with it anyway.
add_filter( 'pre_wp_nav_menu', [ $cache, 'get_menu' ], -1, 2 );

// Unfortunately, there is no appropriate action, so we have to (mis)use a filter here. Almost as late as possible.
add_filter( 'wp_nav_menu', [ $cache, 'cache_menu' ], PHP_INT_MAX - 1, 2 );
Expand Down

0 comments on commit 8089e70

Please sign in to comment.