WordPress code for notify members on new posts

If you want to notify your WordPress site users then here is a quick solution which work fine. Add below snippet to the functions.php of your wordpress theme and your users will get email notification once there is a new post.

 
function email_notification($post_ID)  {
    global $wpdb;
    $usersarray = $wpdb->get_results("SELECT user_email FROM $wpdb->users;");
    $users = implode(",", $usersarray);
    mail($users, "New post on vishmax.com", 'Hi, there is a new post on http://www.vishmax.com');
    return $post_ID;
}
add_action('publish_post', 'email_notification');

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