Friday, October 11, 2013

Inform your subscribers every new article

There Newsletter but what if your blog subscribers are not registered?

Here's A Hack For Automatically Send An Email To Your Subscribers From WordPress Blog In Every Issue From a New Article

Just insert the following code in the "function.php" file of your theme. Remember to save the original file before making any changes.

function email_members($post_ID)  {
    global $wpdb;
    $usersarray = $wpdb->get_results("SELECT user_email FROM $wpdb->users;");    
    $users = implode(",", $usersarray);
    mail($users, "New WordPress recipe online!", 'A new recipe have been published on http://www.wprecipes.com');
    return $post_ID;
}

add_action('publish_post', 'email_members');

Once saved, all registered users will receive an email when a new post is published.

Discover also: 10 WordPress hacks easy to implement

Sourcewprecipes.com
Share it Please

0 comments:

Post a Comment

Copyright @ 2013 Johnny Gagnon blog. Designed by Templateism | Love for The Globe Press