我有一个插件,它使用transition_post_status
钩子,在更新后启动自定义函数。但我不知道为什么它不起作用。这是代码
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);
}
}
}