[wp-trac] [WordPress Trac] #53084: wp_delete_attachment deletes file even if $force_delete is false
WordPress Trac
noreply at wordpress.org
Sun Apr 25 16:24:04 UTC 2021
#53084: wp_delete_attachment deletes file even if $force_delete is false
--------------------------+------------------------------
Reporter: pubalacon | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version:
Severity: normal | Resolution:
Keywords: needs-patch | Focuses:
--------------------------+------------------------------
Changes (by joyously):
* severity: major => normal
Comment:
Do you have a test case, or were you just reading the code?
The `$force_delete` variable is checked near the top of the function, and
uses an early return, so it matches the description, which says
> The attachment is moved to the Trash instead of permanently deleted
unless Trash for media is disabled, item is already in the Trash, or
$force_delete is true.
{{{
if ( ! $force_delete && EMPTY_TRASH_DAYS && MEDIA_TRASH && 'trash' !==
$post->post_status ) {
return wp_trash_post( $post_id );
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53084#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list