Advertisement
geminilabs

[site-reviews] clear plugin caches after submitting a review

Apr 28th, 2019
347
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Use this if you have the "WP Super Cache" installed.
  3.  * This snippet clears the "WP Super Cache" cache for the current page after submitting a review
  4.  * Add to your theme's function.php file
  5.  * @return void
  6.  */
  7. add_action( 'site-reviews/review/created', function() {
  8.     if( function_exists( 'wp_cache_post_change' )) {
  9.         wp_cache_post_change( get_the_ID() );
  10.     }
  11. });
  12.  
  13. /**
  14.  * Use this if you have the "WP Fastest Cache" installed.
  15.  * This snippet clears the "WP Fastest Cache" cache for the current page after submitting a review
  16.  * Add to your theme's function.php file
  17.  * @return void
  18.  */
  19. add_action( 'site-reviews/review/created', function() {
  20.     if( defined( 'WPFC_MAIN_PATH' )) {
  21.         // This WPFC hook was intended for "kk Star Ratings" but should also work for Site Reviews
  22.         do_action( 'kksr_rate', get_the_ID() );
  23.     }
  24. });
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement