Skip to content

Instantly share code, notes, and snippets.

@jchristopher
Created April 18, 2019 16:55
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/39f5a2e01e8e5d780a840993cc016aef to your computer and use it in GitHub Desktop.
Save jchristopher/39f5a2e01e8e5d780a840993cc016aef to your computer and use it in GitHub Desktop.
Customize SearchWP arguments when performing a search
<?php
// Customize SearchWP arguments when performing a search.
add_filter( 'searchwp_search_args', function( $args ) {
// $args['terms'] // The search terms for this request.
// $args['engine'] // The engine used for the search.
// $args['page'] // Which page of results to retrieve.
// $args['posts_per_page'] // How many posts per page to retrieve.
// $args['order'] // Sorting order of results (ASC or DESC).
// $args['load_posts'] // Whether to load the full WP_Post object for each result.
// TODO: Customize $args to match your needs.
return $args;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment