Article updated 1 March 2020 at 1 h 55 me

 

How to set the number of results to display in search of a WordPress blog.

Add this line in fonction.php
Edit as desired line 5 the number of post you want to display per page in your results.

// Modifier le nombre de résultats de recherche
add_filter('pre_get_posts', 'wpm_search_results');
function wpm_search_results() {
if ( is_search() ){
set_query_var('posts_per_archive_page', 30);
}
}

 

Thanks to WPkube


0
0.0 rating
0 / 5 stars (0 view)
Excellent0%
Very good0%
Average0%
Poor0%
Horrible0%

Cancel

 

Rate this article

Leave a Reply

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