Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Programmatically pause the SearchWP indexer during a content import
<?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
my_begin_content_import();
// 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' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment