I have a plugin which uses the transition_post_status
hook, to fire a custom function on post update. But I don't know why its not working.
Here is the code
add_action('transition_post_status', 'pmc_update_notification',10,3);
function pmc_update_notification($new_status, $old_status, $post) {
echo 'function checkpoint 1';
$options = get_option('pmc_setting');
if($options['snpi'] != false && is_single()){
if ( $old_status == 'publish' && $new_status == 'publish' ) {
echo 'function checkpoint 2';
$post_title = get_the_title($post);
$post_url = get_permalink($post);
$message = __('Post updated','pmc').":\n";
$message .= $post_title . ": " . $post_url;
// Send notification
pmc_send($message);
}
}
}
wp_head