Created
April 11, 2017 02:43
-
-
Save RiFi2k/ab9e143124fca59ec5887f8456369161 to your computer and use it in GitHub Desktop.
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
// Add the hook action | |
add_action('transition_post_status', 'send_new_post', 10, 3); | |
// Listen for publishing of a new post | |
function send_new_post($new_status, $old_status, $post) { | |
if('publish' === $new_status && 'publish' !== $old_status && $post->post_type === 'post') { | |
// Do something! | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment