This Documentation is for SearchWP Version 3

Available since: 1.0


View Parameters »

This hook allows you to directly filter the results returned by SearchWP. This hook provides you with an array of post IDs that you can manipulate before they are returned upstream, allowing you to inject your own post IDs where you would like.

function my_searchwp_query_results( $post_ids, $args ) {
// $post_ids is an array of post IDs returned by the search, you can
// manipulate it by adding/removing your own IDs
return $post_ids;
add_filter( 'searchwp_query_results', 'my_searchwp_query_results', 10, 2 );
view raw gistfile1.php hosted with ❤ by GitHub


Parameter Type Description
$post_ids Array

The post IDs retrieved by SearchWP

$args Array

SearchWP arguments