sending an email when a scheduled post is published
-
This is my first attempt at a plugin, and I’m not even sure what I need to google to find the answer. I wrote (copy and pasted) a plugin to email the content of a post when you click publish. That part works, but if you schedule a post, it sends a blank email when it is published. I think the problem is because of how I’m getting the post:
global $wpdb, $post_ID, $current_user; $post = $wpdb->get_row( "SELECT post_title FROM $wpdb->posts WHERE ID = " . $post_ID); $content = $wpdb->get_row( "SELECT post_content FROM $wpdb->posts WHERE ID = " . $post_ID);
Then later I’ve used:
`add_action(‘publish_post’, ‘rhk_send_email’);’
Again, this works if you click Publish, but I need it to work for scheduled posts.
Thanks!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘sending an email when a scheduled post is published’ is closed to new replies.