Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Force SearchWP to perform a delta update of a post after it was edited
<?php
function my_batcache_searchwp_delta_update( $post_id ) {
if ( class_exists( 'SearchWP' ) ) {
if ( $post->post_type != 'revision' && get_post_status( $post_id ) == 'publish' ) {
$searchwp = SearchWP::instance();
$searchwp->purgePost( $post_id );
$searchwp->triggerReindex();
}
}
}
add_action( 'clean_post_cache', 'my_batcache_searchwp_delta_update', 999 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.