Trying to create a WordPress plugin from a tutorial that sends the author of the post a e-mail confirming that their post has been published. here is the code
add_action('publish_post', 'post_published_notification', 10, 2);
function post_published_notification($ID, $post) {
$email = get_the_author_meta('user_email', $post->$post_author);
$subject = 'Published ' . $post->$post_title;
$message = 'We just published your post' . $post->$post_title . 'take a look ' . get_permalink($ID);
wp_mail($email, $subject, $message);
}
The code seems to be correct, but when I published a post, nothing happens I was wondering if was because I am creating the plugin on a Local host WAMP server and not on a live server? Not sure please help.
After uploading the plugin to a live site the plugin did work correctly. So running the plugin on local server was the problem.