我已将操作“draft\\u to\\u pending”设置为在自定义帖子类型上激发。我假设,当用户单击“Status»Edit”将其更改为“Pending”,然后单击“Save Pending”时,该操作应该会触发,但似乎不会触发。
这是我的代码:
add_action(\'draft_to_pending\',\'notify_email_rejected\',99);
function notify_email_rejected($post){
$post_id = $post->ID;
$is_rejected = get_post_meta($post_id,\'rejected_listing\',true);
$owner_id = get_post_meta($post_id,\'owner\',true);
$owner = get_userdata($owner_id);
$to = $owner->user_email;
$headers = "From: HayForSale <[email protected]>\\r\\n";
$headers .= "MIME-Version: 1.0\\r\\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\\r\\n";
$subject = \'Your listing was rejected at HayForSale.com\';
$rejection = get_post_meta( $post_id, \'rejection_message\', true );
$message = \'some html\';
wp_mail($to, $subject, $message, $headers);
}