Is it possible with the standard build-in tools in WordPress to get wp_query to only return the count of an query?

Right now, I’ve a query which has several meta_queries but what the only thing I’m interested in is the actually count of the query.

I know that I can use the found_posts property but the query itself generates a big overhead by query SELECT * and thus returns the whole object.

I could just as easy query the DB with a custom query using $wpdb but I would like to utilize the build-in query system if possible..

I’ve been looking for the answer for this on SE and Google but came on empty.

If I’ve explained myself poorly, please let me know and I’ll try to elaborate.

Cheers

Read more here: Return only Count from a wp_query request?


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: