When I delete a user, WordPress can just delete the post or page of this user, not his custom post and his attachments.
An idea for a special hook?
add_action( 'delete_user', 'my_delete_user');
function my_delete_user($user_id) {
$user = get_user_by('id', $user_id);
$the_query = new WP_Query( $args );
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
wp_delete_post( $post->ID, false );
// HOW TO DELETE ATTACHMENTS ?
}
}
}
Mic
;) - "Thanks" and signature are considered noise in the content and normally removed by your peers. Cheers!