post_types_to_delete_with_user

post_types_to_delete_with_user

Hook Type: filter

See hook in core

Displaying hooks found in version: wordpress-5.4.1

apply_filters('post_types_to_delete_with_user') is found 1 times:

  • /wp-admin/includes/user.php line 387
    		 *
    		 * @param string[] $post_types_to_delete Array of post types to delete.
    		 * @param int      $id                   User ID.
    		 */
    		$post_types_to_delete = apply_filters( 'post_types_to_delete_with_user', $post_types_to_delete, $id );
    		$post_types_to_delete = implode( "', '", $post_types_to_delete );
    		$post_ids             = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d AND post_type IN ('$post_types_to_delete')", $id ) );
    		if ( $post_ids ) {
    			foreach ( $post_ids as $post_id ) {
    				wp_delete_post( $post_id );
    			}