[wp-trac] [WordPress Trac] #60199: update_menu_item_cache appears to load postmeta for all linked posts

WordPress Trac noreply at wordpress.org
Fri Jan 12 18:20:30 UTC 2024


#60199: update_menu_item_cache appears to load postmeta for all linked posts
-------------------------------+------------------------------
 Reporter:  huemordave         |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Menus              |     Version:  6.4.2
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:  performance
-------------------------------+------------------------------
Changes (by spacedmonkey):

 * keywords:   => reporter-feedback


Comment:

 @huemordave Thanks for your ticket.

 I am not sure what is being ask here from a code standpoint. The issue
 here is the plugin you using it missing using post meta and storing large
 bobs of data in post meta. Normally is only recommended to store around
 1MB in post meta.

 Within your code you can fix this by disabling `update_menu_item_cache`
 for all query.

 Using a filter like this should work.

 {{{#!php
 add_action( 'parse_query', function ( &$wp_query ) {
       $wp_query->query_vars['update_menu_item_cache'] = false;
 }, 1 );
 }}}

 That would you could maintain this in your own codebase without the need
 to hack / change core files.

 Does this solve your problem?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60199#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list