wp_delete_post() deletes post instead of moving it to trash

Following the line of code

https://core.trac.wordpress.org/browser/tags/4.9/src/wp-includes/post.php#L2467

if ( ! $force_delete && ( 'post' === $post->post_type || 'page' === $post->post_type ) && 'trash' !== get_post_status( $postid ) && EMPTY_TRASH_DAYS ) {
    return wp_trash_post( $postid );
}

the $force_delete just work with ‘post’ and ‘page’, it not work with custom post type

Leave a Comment