Note: You are viewing the documentation for Version 3View Version 4 Docs

Documentation

View the installation guide, browse the Knowledge Base, find out about SearchWP's many hooks, get support

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:

<?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' );
view raw functions.php hosted with ❤ by GitHub

Parameters

Parameter Type Description
$remove Boolean

Whether to remove all usage of pre_get_posts during searches

Fix keyword search on your site. No coding required!

Now you can utilize all of the content that's gone unrecognized by native WordPress keyword search instantly with SearchWP

Get SearchWP