Issue with adding count to “subsubsub” aka quick links on custom_post_type

Use pre_get_posts filter & use is_main_query() function to check for the context (as you’ve figured out in the conversation with @Milo), however, don’t use is_main_query() directly.

When you use is_main_query() to check the context, it always checks against the main global $wp_query, instead of another custom query object you may want. So it may cause unexpected behaviour.

To make sure you are filtering the correct context, use the $query parameter that’s passed to the callback function of pre_get_posts filter hook. So instead of checking is_main_query(), you’ll be checking $query->is_main_query(). For example:

function wpse_example_filter( $query ) {
    if ( is_admin() && $query->is_main_query() ) {
        // $query modification CODE
    }
}
add_action( 'pre_get_posts', 'wpse_example_filter' );