This Documentation is for SearchWP Version 3

Available since: 2.8.2


View Parameters »

SearchWP aims to integrate with all themes and plugins, but there can be times when search results do not match that of the HTML comment block that is output when debugging is enabled. This means that SearchWP’s results are being overridden by some other code. Many times the culprit is usage of the pre_get_posts hook.

Using this hook we can (during searches only) remove all usage of pre_get_posts to circumvent the problem:

// Prevent incompatibility with SearchWP by removing all usage of pre_get_post during searches.
add_filter( 'searchwp_remove_pre_get_posts_during_search', '__return_true' );
view raw functions.php hosted with ❤ by GitHub


Parameter Type Description
$remove Boolean

Whether to remove all usage of pre_get_posts during searches