Cache primary nav menu
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.
Updated by Boone Gorges almost 5 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