humanmade / nav-menu-cache

Cache WP Nav menus. Designed for use with Human Made's WP Redis.
GNU General Public License v2.0
2 stars 0 forks source link

Clear menu cache when post/term is updated #1

Open mattheu opened 1 year ago

mattheu commented 1 year ago

A current limitation is that if you have a post/page/term in the nav menu, and you update the title of that page, then it will not be updated in the nav menu unless you go and save the nav menu to trigger a cache clearance.

We can loop through all nav menus and check for the presence of the updated post/term and clear the nav menu cache if found.

I was a little concerned that this may not be performant enough to run on post_updated, if you have a lot of nav menus, with lots of items. Which is why I moved it to a cron.