Created
February 14, 2017 16:06
-
-
Save fueledbyboredom/bdc5651d7ec796637ed742cc12c1f564 to your computer and use it in GitHub Desktop.
Get more search results per page, in this example it is set to return 25 per 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
<?php | |
function mwpf_search_results_per_page( $query ) { | |
global $wp_the_query; | |
if ( ( ! is_admin() ) && ( $query === $wp_the_query ) && ( $query->is_search() ) ) { | |
$query->set( 'mwpf_search_results_per_page', 25 ); | |
} | |
return $query; | |
} | |
add_action( 'pre_get_posts', 'mwpf_search_results_per_page' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment