[wp-trac] [WordPress Trac] #37094: wp_get_nav_menu_items should use tax_query

WordPress Trac noreply at wordpress.org
Tue Jun 20 21:55:38 UTC 2017

#37094: wp_get_nav_menu_items should use tax_query
 Reporter:  spacedmonkey           |       Owner:
     Type:  enhancement            |      Status:  new
 Priority:  normal                 |   Milestone:  4.9
Component:  Menus                  |     Version:  3.0
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |     Focuses:  performance

Comment (by spacedmonkey):

 So the reason I created this ticket is I have a navigation caching plugin.
 I noticed that when profiling, that get_objects_in_term runs a query.
 get_objects_in_term has no hooks or caching, so there was nothing I could
 do about that query.

 By using the tax query and tt_id, it results in on extra query. However,
 if the site has lots of terms and linked, I could understand it might be
 slow. However, this is a general problem with the tax query.

 Personally, I would use the tax query and work on #22176 and #37038
 tickets. In short, do this query in the wordpress way (a tax query) and
 make the rest of the core better around it.

 But I am not against `get_objects_in_term`, it is a quick and simple

Ticket URL: <https://core.trac.wordpress.org/ticket/37094#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list