On a website with over 1 million posts, the following from class WP_Posts_List_Table __construct() is taking a long time:

FROM wp_posts
WHERE post_type = 'shop_order'
AND post_status NOT IN ( 'trash','auto-draft','inherit','request-pending','request-confirmed','request-failed','request-completed','wc-checkout-draft' )
AND post_author = 1 

Since post_author = 1 has many posts, this takes a long time to execute. For post_authors without any post, this query is fast. One way of speeding this up is adding a condition such that this query doesn't run when post_author = 1. Is there any other better way to do this without having to edit core wordpress files since there are no hooks in this query?



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.