Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#44792 closed defect (bug) (duplicate)

Add filter to get_post_class to solve get_taxonomies performance issues

Reported by: steveo2000's profile steveo2000 Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.9.8
Component: Posts, Post Types Keywords:
Focuses: Cc:


We have uncovered while running WooCommerce dashboard (but could also effect anything using WP_Posts_List_Table) that on a post type with 20 posts per page this calls get_post_class() 20 times, which in turn queries all public taxonomies by get_taxonomies() 20 times.

If you have lots of taxonomies this causes huge slow downs when accessing the page.

A 20 product per page WooCommerce site loaded in 20 seconds, if I remove the get_taxonomies call it reduces it by 50%. Can you add a filter to this so we can stop this depending on the page you are on? - in my case if I am on the product listings page in the dashboard I need to restrict this occurring to reduce the load times.

Change History (2)

#1 @steveo2000
5 years ago

This is within wp-includes/post-template.php line 510

#2 @swissspidy
5 years ago

  • Component changed from General to Posts, Post Types
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Thanks for your report and welcome to Trac!

We're already tracking this issue in #37114.

Note: See TracTickets for help on using tickets.