This Documentation is for SearchWP Version 3

Available since: 1.0


By default the SearchWP indexer runs all the time in the¬†background. It isn’t constantly indexing but is instead waiting for various triggers to cause an index operation to take place. There are certain times when you will want to prevent the indexer from indexing so as to save resources (e.g. during a content import) and with this hook you can do just that.

Example: To¬†prevent the indexer from running during a content import, add the following to your theme’s functions.php:

// in order to prevent the SearchWP indexer from being triggered many times at once
// we are going to disable it while we run our content import like so:
add_filter( 'searchwp_indexer_enabled', '__return_false' );
// process our content migration
// with the migration complete we can re-enable the SearchWP indexer and
// it will pick up all of the content that was just imported
remove_filter( 'searchwp_indexer_enabled', '__return_false' );
view raw gistfile1.php hosted with ❤ by GitHub

Note: The my_begin_content_import() function is a placeholder function that represents your content migration functionality, it is not a SearchWP function nor a WordPress function.