How to count posts with specific arguments
The easiest way to optimize this query would be to add ‘fields’ => ‘ids’ to the arguments. This way only ids of posts will be retrieved from DB (and usually that’s a big change). $args = [ ‘numberposts’ => -1, ‘post_type’ => ‘jobs’, ‘s’ => ‘developer’, ‘tax_query’ => [‘taxonomy’ => ‘IT’, ‘field’ => ‘slug’], ‘fields’ … Read more