Available since: 2.8.2
searchwp_remove_pre_get_posts_during_search
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:
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 | |
// 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' ); |
Parameters
Parameter | Type | Description |
---|---|---|
$remove |
Boolean |
Whether to remove all usage of pre_get_posts during searches |