Do action for only switch status for publish_post

You can use the transition_post_status hook, which is fired whenever the status is changed. So to perform an action when the status is changed to publish, you’d do this: function notificationApprove( $new_status, $old_status, $post ) { if ( ‘publish’ === $new_status && ‘publish’ !== $old_status && ‘post’ === $post->post_type ) { // Send mail } … Read more

How to send post notification when a Author and Contributor post?

Try this. I’ve tested it and it works although your questions is not so clear (snippet VS description). function wpkse_144405_on_post_publish( $ID, $post ) { $users = get_users( array( ‘fields’ => array( ‘user_email’ ) ) ); $email_subject=”New post has been published”; $message .= ‘New post has been published: ‘ . $post->post_title . ‘ You can preview … Read more

Display emails of users who already posted at least once

You can place following code in your functions.php file & use the shortcode [myblogwriters min_posts=”1″] anywhere in the page/post content and can also change the min_posts value 🙂 function show_min_one_post_writers($atts){ global $wpdb; $attrs = shortcode_atts( array( ‘min_posts’ => ” ), $atts ); $min_posts = $attrs[‘min_posts’]; $authors = $wpdb->get_col(“SELECT `post_author` FROM (SELECT `post_author`, COUNT(*) AS `count` … Read more