id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc,focuses 43672,wp_delete_post() function ignores `$force_delete` parameter for custom post types,sudar,,"The `wp_delete_post()` function has a second optional parameter called `$force_delete` (default false) that decides whether to send the post to trash or delete it permanently. But when the function is invoked with a post id that belongs to a custom post type, this parameter is ignored and the post is always deleted permanently and never sent to trash. Here is the relevant code inside that function that does this. {{{ if ( ! $force_delete && ( 'post' === $post->post_type || 'page' === $post->post_type ) && 'trash' !== get_post_status( $postid ) && EMPTY_TRASH_DAYS ) { return wp_trash_post( $postid ); } }}} I think the post types check in the above condition should not be made, but I am not sure why it is there and what are the implications of it. Steps to replicate this issue. - Create a post in a custom post type and note the post id. - Make the call to the function. Assuming 42 is the post id, the call will be `wp_delete_post( 42, false)` - Since the `$force_delete` parameter is set to `false`, the expectation is that the post should be sent to trash - But the post will be permanently deleted If it is agreed that it is a bug, then I can submit a patch to remove the post type check. ",defect (bug),new,normal,Awaiting Review,"Posts, Post Types",,normal,,dev-feedback,,administration