Available since: 1.9
searchwp_force_run
By default SearchWP will only hijack the array of posts objects returned if these conditions are met:
- Not in the WordPress Admin (
is_admin()
) - A search is taking place (
is_search()
) - It is the main query (
is_main_query()
)
If you would like to override the second item in that list, add 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 | |
add_filter( 'searchwp_force_run', '__return_true' ); |
You will only want to use this filter in the context of some other condition being met, else SearchWP will fire for every WP_Query
that takes place.