Created
January 22, 2015 14:14
-
-
Save jchristopher/de7bf85297c2e2ec0878 to your computer and use it in GitHub Desktop.
Filter the array of results returned by SearchWP
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_results( $results, $attributes ) { | |
// available $attributes are: | |
// | |
// $attributes['terms'] the search terms | |
// $attributes['page'] the current page | |
// $attributes['order'] the results order | |
// $attributes['foundPosts'] the number of found posts | |
// $attributes['maxNumPages'] the total number of pages of results | |
// $attributes['engine'] the engine in use | |
// modify $results in any way you'd like | |
return $results; | |
} | |
add_filter( 'searchwp_results', 'my_searchwp_results', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment