Created
March 13, 2017 10:05
-
-
Save vyskoczilova/342da21daae64d92b2e8caa70f583810 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function change_wp_search_size($query) { | |
if ( $query->is_search ) // Make sure it is a search page | |
$query->query_vars['posts_per_page'] = 10; // Change 10 to the number of posts you would like to show | |
return $query; // Return our modified query variables | |
} | |
add_filter('pre_get_posts', 'change_wp_search_size'); // Hook our custom function onto the request filter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment