Do you ever wish to send your registered user’s an email whenever you do a new post , well this is basically very useful if you have a big list of user registered on your WordPress blog
So now lets implement this hacks go to functions.php and add the below code
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 WordPress Den", 'A new post have been published on http://www.wpden.net'); return $post_ID; } add_action('publish_post', 'email_members');
Just edit the above code at line 5 to what ever you want