Advertisement
geminilabs

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

Oct 2nd, 2020
1,667
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.47 KB | None | 0 0
  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
Add Comment
Please, Sign In to add comment
Advertisement