WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 9 months ago

#12538 reopened defect (bug)

WP should cache menus

Reported by: Denis-de-Bernardy Owned by: ryan
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.0
Component: Menus Keywords: needs-patch
Focuses: Cc:

Description

There's a prime example of how to do this in the menu ticket (i.e. the plugin I attached in #11817).

Shouldn't we be doing this in WP as well?

It basically goes:

  • if it's a page, then try a post meta
  • if it's search/404 request, then try a transient
  • if it's anything else, then try a transient

The plugin also handles conditional flushing of the cache based on whether or not the permalink and/or the label changed.

Change History (9)

comment:1 ptahdunbar4 years ago

  • Cc ptahdunbar added
  • Component changed from General to Menus
  • Owner set to ryan

comment:2 ptahdunbar4 years ago

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in r13704

comment:3 nacin4 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:4 follow-up: scribu4 years ago

  • Keywords close added

I'm not so sure this should go into core, the same way that widget caching isn't in core.

The only thing that's cached is RSS feeds, since we don't want to flood other sites.

Installing a plugin like WP Super Cache solves the caching problem for the entire page.

comment:5 voyagerfan57614 years ago

  • Cc WordPress@… added

comment:6 ryan4 years ago

  • Milestone 3.0 deleted
  • Resolution set to wontfix
  • Status changed from reopened to closed

comment:7 in reply to: ↑ 4 prettyboymp2 years ago

  • Keywords close removed
  • Resolution wontfix deleted
  • Status changed from closed to reopened

Replying to scribu:

I'm not so sure this should go into core, the same way that widget caching isn't in core.

The only thing that's cached is RSS feeds, since we don't want to flood other sites.

Installing a plugin like WP Super Cache solves the caching problem for the entire page.

I think this needs to be revisited, even if it's just creating a way to allow a plugin to cache the wp_get_nav_menu_items() function. A simple menu that is only one level deep causes 3 extra queries.

Almost all core widgets have caching or use functions that have caching built in and WP Super Cache isn't a solution for sites that have a high percentage of logged in users.

comment:8 SergeyBiryukov2 years ago

  • Milestone set to Awaiting Review

comment:9 mdawaffe9 months ago

  • Keywords needs-patch added
Note: See TracTickets for help on using tickets.