Available since: 1.7.2
searchwp_found_post_objects
View Parameters »If you would like to manipulate the post objects returned by a SearchWP query, you can use this hook to do so. Please note that this hook does not fire if you have prevented SearchWP from loading post objects.
To filter the array of post objects returned by a SearchWP query, add something like the following to your theme’s functions.php
:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_searchwp_found_post_objects( $posts, $args ) { | |
// manipulate the $posts array in any way you'd like | |
return $posts; | |
} | |
add_filter( 'searchwp_found_post_objects', 'my_searchwp_found_post_objects', 10, 2 ); |
Parameters
Parameter | Type | Description |
---|---|---|
$posts |
Array |
Returned post objects |
$args |
Array |
Arguments passed to a call to |