Skip to content

Instantly share code, notes, and snippets.

@jchristopher
Created January 21, 2015 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jchristopher/f1d53dd77184808e5221 to your computer and use it in GitHub Desktop.
Save jchristopher/f1d53dd77184808e5221 to your computer and use it in GitHub Desktop.
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