geminilabs

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

Oct 2nd, 2020 (edited)
356
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.52 KB | None | 0 0
  1. /**
  2.  * Clear the Hummingbird 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 (!empty($command->post_id)) {
  10.         do_action('wphb_clear_page_cache', $command->post_id);
  11.     } else {
  12.         do_action('wphb_clear_page_cache');
  13.     }
  14. }, 10, 2);
Add Comment
Please, Sign In to add comment