Created
June 21, 2012 14:26
-
-
Save ekka21/2966035 to your computer and use it in GitHub Desktop.
Wordpress: send email to subscriber when the post is published.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Just paste the following code on your functions.php file | |
function email_members($post_ID) { | |
global $wpdb; | |
$usersarray = $wpdb->get_results("SELECT user_email FROM $wpdb->users;"); | |
$users = implode(",", $usersarray); | |
mail($users, SUBJECT, CONTENT); | |
return $post_ID; | |
} | |
add_action('publish_post', 'email_members'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment