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: 1.0

searchwp_query_results

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.

<?php
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

Parameters

Parameter Type Description
$post_ids Array

The post IDs retrieved by SearchWP

$args Array

SearchWP arguments

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