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.5

searchwp_remove_pre_get_posts

SearchWP makes heavy use of the pre_get_posts core WordPress hook. A lot of other plugins do too. Sometimes usage of this hook can prevent content from being seen by SearchWP’s indexer since it finds content to index using a call to get_posts(). As a solution, SearchWP calls remove_all_actions( 'pre_get_posts' ); to ensure it can see all the content it needs to index.

To prevent the need of constantly reindexing and deindexing content, SearchWP indexes everything it can and conditionally includes it in results based primarily on your engine configuration and secondarily on any hooks you’re using. If you would prefer that SearchWP not remove all of the pre_get_posts filter usage (this only happens during indexing) you can add the following to your theme’s functions.php:

<?php
// prevent SearchWP from calling remove_all_actions( 'pre_get_posts' );
add_filter( 'searchwp_remove_pre_get_posts', '__return_false' );
view raw gistfile1.php hosted with ❤ by GitHub
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