WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 5 months ago

#35048 new feature request

custom menu - OPTIMIZE QUERY!

Reported by: selnomeria Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Menus Keywords:
Focuses: Cc:
PR Number:

Description (last modified by SergeyBiryukov)

hi..
i had an idea - developers should have an ability to set a constant i.e.

USE_STATIC_CUSTOM_MENU('menu_name') = true;

in general, output of custom_menus on front-end, takes long (sometimes 1 second)..
so, i think, that the custom-menu output should be saved as static string, and that should be outputed on FRONT_END request by visitors...
and that STATIC string should be changed/ updated every time the custom-menu is edited, or when any of that custom-menu's item is modified...
i think, it will save huge resources over millions of sites/hosting..

p.s. of course, somehow, "current-menu-item" should be added while front-end request..

Change History (4)

#1 @swissspidy
4 years ago

  • Component changed from General to Menus

#2 @selnomeria
4 years ago

  • Component changed from Menus to General

excuse me, the link (wordpress.org/plugins) in the bottom of my post, is accidentaly pu..

#3 @SergeyBiryukov
4 years ago

  • Component changed from General to Menus
  • Description modified (diff)

#4 @swissspidy
4 years ago

Custom menus are not the only thing that result in a couple of database queries.

For the vast majority of WordPress sites, these queries are not a big deal. That's one of the reasons there's no built-in cache in WordPress and I'm generally recommending plugins for such a solution.

p.s. of course, somehow, "current-menu-item" should be added while front-end request..

That's not really possible with cached output, except when you use JavaScript, which is not something core should provide.

My suggestion is to use one of the many caching plugins available, either a specific one for menus or an all-in-one caching plugin. See https://wordpress.org/plugins/search.php?type=term&q=cache

Note: See TracTickets for help on using tickets.