This article describes how to customize the number of search results that WordPress displays per page. You may want to do this, for example, if your site only has a few posts or a large number of posts.
To customize the number of search results displayed per page, follow these steps:
Copy the following code snippet and then paste it at the bottom of the functions.php file:
function control_search_results() { if ( is_search() ) set_query_var('posts_per_archive_page', 10); // Change 10 to the number of search results you want to appear per page. } add_filter('pre_get_posts', 'control_search_results');
Subscribe to receive weekly cutting edge tips, strategies, and news you need to grow your web business.
No charge. Unsubscribe anytime.
Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.
Usamos cookies con el fin de personalizar para usted nuestro sitio Web y analizar el uso de éste. Usted acepta esto haciendo clic en “Acepto” o al continuar usando el sitio Web. Hay más información sobre cookies en nuestra política de privacidad.