Created
February 10, 2014 20:06
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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