0
一括でコメントを承認すると、1つだけcomment_post_ID
を取得します。
私はすべてcomment_post_ID
を取得する必要があります。WP - 一括コメントの承認ですべてのcomment_post_IDを取得する方法
このコード:
add_action('transition_comment_status', 'my_approve_comment_callback', 10, 3);
function my_approve_comment_callback($new_status, $old_status, $comment) {
if ($old_status != $new_status && $new_status == 'approved') {
$my_file = fopen("/tmp/postidlist.txt", "w");
$comment_id_2 = get_comment($comment->comment_ID);
$comment_post_id = $comment_id_2->comment_post_ID;
fwrite($my_file, $comment_post_id);
fclose($my_file);
}
}