register_post_status – show_in_admin_all_list & show_in_admin_status_list does not affect query

In the register_post_status, I’ve already disabled
show_in_admin_all_list & show_in_admin_status_list for my custom status my_hidden_status

However, from the query log the post_status my_hidden_status it is still not being filtered out (when
loading edit.php)

e.g.

SELECT post_status, COUNT( * ) AS num_posts FROM st_posts WHERE
post_type = ‘my_cpt’ GROUP BY post_status;

The post_status I wanted to filter actually is over 90% of my CPT, so
if the query is rewritten as

SELECT post_status, COUNT( * ) AS num_posts FROM st_posts WHERE
post_type = ‘my_cpt’ AND post_status != ‘my_hidden_status’ GROUP BY
post_status;

It can greatly improve the performance.

It is a bug?

Read more here:: register_post_status – show_in_admin_all_list & show_in_admin_status_list does not affect query

Leave a Reply

Your email address will not be published. Required fields are marked *