SearchWP

This Documentation is for SearchWP Version 3

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
[wpforms id="3080"]