Skip to content

Instantly share code, notes, and snippets.

@tiborp
Created February 20, 2017 12:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tiborp/af31c36d1d397ebaf8c07608ad93beba to your computer and use it in GitHub Desktop.
Save tiborp/af31c36d1d397ebaf8c07608ad93beba to your computer and use it in GitHub Desktop.
Prevent auto indexing
/**
* See: http://www.wpallimport.com/documentation/advanced/action-reference/
*/
//Prevent auto indexing before first import
function drl_before_opleidingen_import($import_id) {
if( $import_id === 4) {
add_filter( 'searchwp_auto_reindex', '__return_false' );
}
}
add_action('pmxi_before_xml_import', 'drl_before_opleidingen_import', 10, 1);
//Start auto indexing after last import
function drl_after_opleidingen_import($import_id) {
if( $import_id === 2 ) {
add_filter( 'searchwp_auto_reindex', '__return_true' );
}
}
add_action('pmxi_after_xml_import', 'drl_after_opleidingen_import', 10, 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment