Feature #10728
closedCache primary nav menu
0%
Description
Ray, would you mind doing a bit of research into caching the primary nav menu? I'm unsure whether we can use an HTML fragment cache (unless we add JS for the current-page highlighting) but we can at least cache the two or three database hits that are triggered on every pageload.
Related issues
Updated by Boone Gorges almost 6 years ago
- Related to Feature #10788: Main query should be either cached or eliminated on primary site added
Updated by Boone Gorges almost 6 years ago
The plugin added in #10788 ought to fix this, but doesn't do so fully. This needs examination.
Updated by Boone Gorges almost 6 years ago
- Target version changed from 1.15 to 1.14.3
The unneeded query was bugging me so I had another look :)
The advanced-post-cache plugin doesn't work because wp_nav_menu() uses get_posts(), which suppresses filters, which in turn breaks the query caching.
I looked at a couple existing solutions and most were bad, but this one does roughly what I would've done had I built it myself: https://bjornjohansen.no/wordpress-menu-cache I've YOLOed it into production. My only concern is about invalidation, so let's keep our ears perked for reports. https://github.com/cuny-academic-commons/cac/commit/1ebcb300d4b39eb2fb628881f4cad7bd72984a95
Updated by Boone Gorges almost 6 years ago
- Status changed from Assigned to Resolved
I think this is working.
Updated by Boone Gorges over 5 years ago
- Related to Bug #11473: My Commons link not present in Navigation on Groups page added
Updated by Boone Gorges about 1 year ago
- Related to Bug #19123: Inconsistent Menu Saving from Theme Customizer added