Skip to content

Instantly share code, notes, and snippets.

@dytra
Created November 7, 2023 09:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dytra/4ca99cd158ed543a3607f4bf8ba98773 to your computer and use it in GitHub Desktop.
Save dytra/4ca99cd158ed543a3607f4bf8ba98773 to your computer and use it in GitHub Desktop.
wordpress plugin extension that injects to recipe_rated hook
<?php
/*
Plugin Name: Udemy Plus Emailer
*/
add_action('recipe_rated',function($data) {
$post = get_post($data['postID']);
$authorEmail = get_the_author_meta('user_email', $post->post_author);
$subject= "Your recipe has received a new rating";
$message="Your recipe {$post->post_title} has received a rating of {$data['rating']}";
wp_mail($authorEmail, $subject,$message);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment