Inspiration For Creative Minds
Home » Labs » How to notify registered user when there is a new post  

Filed under Labs

If you want to send an email notification to registered members of your blog then here is a simple solution. Just copy and paste below code to your functions.php file.

function email_members($post_ID)  {
    global $wpdb;
    $usersarray = $wpdb->get_results("SELECT user_email FROM $wpdb->users;");    
    $users = implode(",", $usersarray);
    mail($users, "New post on blog", 'New post has been published, read it now on');
    return $post_ID;
add_action('publish_post', 'email_members');
It's only fair to share...Share on Google+Tweet about this on TwitterShare on Facebook

Posts you may like: