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


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

Available since: 1.6


SearchWP automatically maintains it’s index by performing delta updates when content is added, edited, or removed. If you have a high traffic website you may want to offload this behavior to a custom WP-Cron job.

The difference between this hook and searchwp_auto_reindex is that this hook prevents both purging and re-indexing of posts. searchwp_auto_reindex allows for posts to be purged on edit, but not reindexed.

Example: To prevent SearchWP from automatically performing delta updates, add the following to your active theme’s functions.php:

// prevent SearchWP from automatically maintaining it's index
add_filter( 'searchwp_background_deltas', '__return_false' );
view raw gistfile1.php hosted with ❤ by GitHub

Note that if you disable automatic index updates, you will need to periodically tell SearchWP to update it’s index. You can do so by setting up a custom WP-Cron job or something similar, but the important part is to ensure you fire the following:

// Manually process flagged index updates
if( function_exists( 'SWP' ) ) {
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