Skip to content

Instantly share code, notes, and snippets.

@digamber89
Created April 18, 2024 06:36
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 digamber89/137f780f2ca4d390096762ebaac8f21b to your computer and use it in GitHub Desktop.
Save digamber89/137f780f2ca4d390096762ebaac8f21b to your computer and use it in GitHub Desktop.
SWT: Stop Indexing on Update
<?php
function cm_stop_index_on_update_20240418(){
if( class_exists('\Codemanas\Typesense\Main\EventListener')){
$instance = \Codemanas\Typesense\Main\EventListener::getInstance();
remove_action( 'wp_after_insert_post', [$instance, 'postCreatedUpdatedHandler'], 10 );
//The code below stops from deleting posts when it is deleted.
// remove_action( 'delete_post', [ $instance, 'postDeletedHandler' ], 10);
// remove_action( 'wp_trash_post', [ $instance, 'postDeletedHandler' ], 10 );
}
}
add_action('init','cm_stop_index_on_update_20240418' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment