投稿がゴミ箱に送られたときにwp_mailを送信できません。以下は私が使用している機能です。誰かが助けることができたら。ゴミ箱にwp_mailを送信できません
function post_rejection_email() {
//Email Setup
$post_status = get_post_meta(the_ID(), 'post_status', true);
$post_name = $post->post_title;
//Email Details
$email = get_the_author_meta('user_email');
$author_name = the_author_meta('first_name');
$subject = 'Sorry, your post has been refused.';
$post_type = 'event_listing';
$message = 'Dear ' . $author_name . '. Unfortunately your post: ' . $post_name . ' has been refused.';
if ($post_status == 'trash' && $post->post_type == $post_type) {
wp_mail($email, $subject, $message);
}
}
add_action('transition_post_status', 'post_rejection_email', 10, 3);
私はメールを受け取っていません。私が間違っている場所を知らないでください。助けてください。
あなたのコードがIF文を入力してもよろしいですか? – cosmoonot
それは私が把握しようとしているものです。私が間違っていることは何ですか? –
私はそれが 'ごみ'ステータスを取得しないと思う..私は別のステータスと別の機能を持って1つ正常に働いて.. post_status = 'ゴミ箱'は何もしていない.. –