By default, mostly WordPress has 10 results on the search page when we search a keyword. Let me tell you “How to show Desired numbers of search results in one search page”?
Step 1: Go to the admin dashboard
Step 2: Select Appearance
Step 3: Select the Theme file editor
Step 4: Open functions.php
Step 5: Add the following code at the bottom of functions.php
1 2 3 4 5 6 | function custom_search_results_per_page( $query ) { if ( $query->is_search ) { $query->set( 'posts_per_page', 50 ); // Change 10 to the number of results you want to display } } add_action( 'pre_get_posts', 'custom_search_results_per_page' ); |