[wp-trac] [WordPress Trac] #27120: Add object cache to wp_nav_menu() items

WordPress Trac noreply at wordpress.org
Sun Mar 11 19:03:24 UTC 2018


#27120: Add object cache to wp_nav_menu() items
-------------------------------------------------+-------------------------
 Reporter:  Clorith                              |       Owner:
     Type:  enhancement                          |      Status:  reopened
 Priority:  normal                               |   Milestone:
Component:  Menus                                |     Version:  3.8
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch 2nd-opinion has-unit-      |     Focuses:  template,
  tests                                          |  performance
-------------------------------------------------+-------------------------
Changes (by soulseekah):

 * keywords:  has-patch 2nd-opinion => has-patch 2nd-opinion has-unit-tests
 * status:  closed => reopened
 * resolution:  maybelater =>


Comment:

 Maybe now? :)

 @campusboy1987 pointed out that the same `wp_nav_menu()` calls (for
 example in twentysixteen header.php and footer.php) generate a duplicate
 query.

 With help from @versusbassz @campusboy1987 @denisco this patch was put
 together.

 1. Added an item cache around the `get_posts()` call inside
 `wp_get_nav_menu_items()`.
 2. Invalidation is inside `wp_update_nav_menu_item()`
 3. Some tests, including invalidation.

 Thanks :)

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


More information about the wp-trac mailing list