Display Search Result Count In WordPress

This is a handy PHP code snippet which enables the developers to display the search result count in WordPress. To display the search results count, open your search template i.e. search.php file and add the following code. Here, we are retrieving search results count from global $wp_query.

Useful Read : Force Dashboard to Display a Single Column Only

global $wp_query;
echo $wp_query->found_posts.' results found.';

 

0 Comments

Leave a Comment.