Advertisement
geminilabs

[site-reviews] get additional notification emails from the assigned post meta

May 26th, 2021 (edited)
959
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * @param array $emails
  3.  * @param \GeminiLabs\SiteReviews\Review $review
  4.  * @return array
  5.  */
  6. add_filter('site-reviews/notification/emails', function ($emails, $review) {
  7.     $posts = $review->assignedPosts();
  8.     foreach ($posts as $post) {
  9.         $email = get_post_meta($post->ID, 'company_email', true);
  10.         if (is_email($email)) {
  11.             $emails[] = $email;
  12.         }
  13.     }
  14.     return $emails;
  15. }, 10, 2);
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement