Advertisement
geminilabs

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

May 26th, 2021 (edited)
1,192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.43 KB | None | 0 0
  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
Add Comment
Please, Sign In to add comment
Advertisement