Skip to content

Instantly share code, notes, and snippets.

@jchristopher
Created February 10, 2014 20:06
Show Gist options
  • Save jchristopher/8923192 to your computer and use it in GitHub Desktop.
Save jchristopher/8923192 to your computer and use it in GitHub Desktop.
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