Note: You are viewing the documentation for Version 3View Version 4 Docs

Documentation

View the installation guide, browse the Knowledge Base, find out about SearchWP's many hooks, get support

Available since: 2.8.3

searchwp_search_args

View Parameters »

You can use this hook to filter SearchWP’s search arguments in real time. The arguments are passed as a single parameter:

<?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;
} );
view raw functions.php hosted with ❤ by GitHub

Parameters

Parameter Type Description
$args Array

$args['terms']
$args['engine']
$args['page']
$args['posts_per_page']
$args['order']
$args['load_posts']

Fix keyword search on your site. No coding required!

Now you can utilize all of the content that's gone unrecognized by native WordPress keyword search instantly with SearchWP

Get SearchWP