Created
August 26, 2013 14:58
-
-
Save gdeguglielmo/6342346 to your computer and use it in GitHub Desktop.
WordPress - Show every result on search page
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
/* Display all results on search page */ | |
function change_wp_search_size($query) { | |
if ( $query->is_search ) // Make sure it is a search page | |
$query->query_vars['posts_per_page'] = -1; // 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'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment