Advertisement
geminilabs

[site-reviews] Purge WP-Optimize page cache after a review is submitted

Oct 2nd, 2020
1,403
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Purge the WP-Optimize cache for the page after a review has been created.
  3.  * Paste this in your active theme's functions.php file.
  4.  * @param \GeminiLabs\SiteReviews\Review $review
  5.  * @param \GeminiLabs\SiteReviews\Commands\CreateReview $command
  6.  * @return void
  7.  */
  8. add_action('site-reviews/review/created', function ($review, $command) {
  9.     if (class_exists('WPO_Page_Cache')) {
  10.         WPO_Page_Cache::delete_single_post_cache($command->post_id);
  11.     }
  12. }, 10, 2);
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement