How to notify registered user when there is a new post

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.

 
<?php
 
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 yoursite.com');
    return $post_ID;
}
 
add_action('publish_post', 'email_members');
 
?>

Related posts:

HTML5 page structure

HTML5 offers more powerful structure comparing to older versions of Html. There are many new …


Partner with Us

We are providing an exclusive partnership offer to individuals and companies who are interested in setting up their own web design & development company. For more information about how to partner with us, please contact us