Skip to content

Instantly share code, notes, and snippets.

@jchristopher
Last active February 12, 2020 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jchristopher/7852546 to your computer and use it in GitHub Desktop.
Save jchristopher/7852546 to your computer and use it in GitHub Desktop.
Customize the number of posts per page in SearchWP results
<?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