[wp-trac] [WordPress Trac] #31724: Multiple calls get_terms() when: custom taxonomy (with no posts in it) and wp_nav_menu

WordPress Trac noreply at wordpress.org
Mon Mar 23 03:59:59 UTC 2015


#31724: Multiple calls get_terms() when: custom taxonomy (with no posts in it) and
wp_nav_menu
--------------------------+------------------------------
 Reporter:  kg69design    |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  4.1.1
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  performance
--------------------------+------------------------------
Changes (by kg69design):

 * keywords:  reporter-feedback =>


Comment:

 Thank you for your attention. My actions step by step.

 1. Install clean wordpress 4.1.1. with default theme "Twentyfifteen"
 2. Add get_num_queries() in footer.php - and get 22 queries on homepage
 3. Add register_post_type() and register_taxonomy() to function.php like
 this: (after that still get 22 queries on homepage)

 {{{
 add_action('init', 'custom_post_type_and_taxonomy');

 function custom_post_type_and_taxonomy() {
         $args = array(
                 'label'                 => 'Equipment',
                 'public'                => true,
                 'menu_position'         => 5,
                 'supports'              => array('title', 'editor',
 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments'),
                 'taxonomies'            => array('catalog'),
                 'rewrite'               => array('slug' => 'equipment')
         );
         register_post_type('equipment', $args);

         $args = array(
                 'label'                 => 'Catalog',
                 'show_admin_column'     => true,
                 'hierarchical'          => true,
                 'rewrite'               => array('slug' => 'catalog')
         );
         register_taxonomy('catalog', array('equipment'), $args);
 }
 }}}

 4. Create new taxonomy category "Test" and 10 subcategories in it (after
 that still get 22 queries on homepage)
 5. Create new empty menu in admin, assign it to location "Primary Menu"
 (after that get 21 queries on homepage)
 6. Add link to taxonomy category "Test" in this new menu (add screenshot
 "menu.png")
 7. Now I have 34 queries on homepage. If I add +1 subcategory to taxonomy
 category "Test" (another 1st-level taxonomy category does not increase
 queries on site) - I have +1 query on homepage. So, it seems that we have
 problem here.
 8. If I add one post in taxonomy category "Test" - I get 24 queries on
 homepage, that is seems to be normal. After that increasing sub-categories
 does not increase queries on site.

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


More information about the wp-trac mailing list