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'); ?> |