[wp-trac] [WordPress Trac] #55428: Improve cache priming in wp_get_nav_menu_items

WordPress Trac noreply at wordpress.org
Tue Mar 22 09:57:15 UTC 2022


#55428: Improve cache priming in wp_get_nav_menu_items
--------------------------+---------------------------
 Reporter:  spacedmonkey  |       Owner:  spacedmonkey
     Type:  enhancement   |      Status:  closed
 Priority:  normal        |   Milestone:  6.0
Component:  Menus         |     Version:  3.0
 Severity:  normal        |  Resolution:  fixed
 Keywords:  has-patch     |     Focuses:  performance
--------------------------+---------------------------
Changes (by spacedmonkey):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"52975" 52975]:
 {{{
 #!CommitTicketReference repository="" revision="52975"
 Menus: Improve cache priming in the `wp_get_nav_menu_items` function.

 In `wp_get_nav_menu_items` multiple function calls to `get_terms` and
 `get_posts` were being used to load post/term objects into
 memory. This change replaces calls to `get_terms` and `get_posts` with
 calls to `_prime_post_caches` and
 `_prime_term_caches`. These functions are designed to prime object caches
 and do not have the overhead of a query object. This
 change also replaces multiple queries with a single query, saving many SQL
 queries per page load.

 Props Spacedmonkey, peterwilsoncc.
 Fixes #55428.
  --This line, and those below,
 will be ignored--

 M    src/wp-includes/nav-menu.php
 }}}

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


More information about the wp-trac mailing list