Last active
February 12, 2020 13:42
-
-
Save jchristopher/7852546 to your computer and use it in GitHub Desktop.
Customize the number of posts per page in SearchWP results
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 my_searchwp_posts_per_page( $posts_per_page, $engine, $terms, $page ) | |
{ | |
if( $engine != 'default' ) { | |
// if this is a supplemental search engine, show 20 results per page | |
return 20; | |
} else { | |
// it's the default search engine, return whatever it was originally | |
return $posts_per_page; | |
} | |
} | |
add_filter( 'searchwp_posts_per_page', 'my_searchwp_posts_per_page', 30, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment