I’m trying to auto-delete all BBpress replies of a user when someone’s account is banned, but the wp_delete_post is not working with replies.
wp_delete_posts() returns a post object if it runs successfully, and it does do this with the reply, but the reply is not deleted from its respective topic!
$args = array (
'numberposts' => -1,
'post_type' => array('topic','reply'),
'author' => $user_id
);
$user_posts = new WP_Query($args);
while ( $user_posts->have_posts() ) : $user_posts->the_post();
wp_delete_post(get_the_ID(), true);
endwhile;