Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#11052 closed defect (bug) (fixed)

Cannot trash Media without title

Reported by: Simek Owned by:
Milestone: 2.9 Priority: normal
Severity: normal Version: 2.9
Component: Trash Keywords: has-patch commit
Focuses: Cc:


Tested on various files.

This problem only exist if file has non-required title field (for ex. PDF, TXT). After upload and delete title new media is added to library with "(no title)" caption in media browser. Until we'll add a title in edit media page this media cannot be deleted in normal and bulk way. Page reload, notification appears, but nothing happened.

Attachments (1)

11052.diff (545 bytes) - added by caesarsgrunt 4 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 ryan4 years ago

  • Component changed from Media to Trash

comment:2 caesarsgrunt4 years ago

Odd. The problem seems to be in wp_insert_post, but I'm not sure exactly what it is...

caesarsgrunt4 years ago

comment:3 follow-up: caesarsgrunt4 years ago

  • Keywords has-patch added; needs-patch removed

The problem is with lines 1613-1618 of wp-includes/post.php, in wp_insert_post(). They throw an error if the content, title, and excerpt are all empty, which has he effect of making it impossible to update (eg trash) an attachment without a title. I don't know what the purpose of these lines is... but my patch fixes the problem by making it not throw the error if the post is an attachment.

comment:4 in reply to: ↑ 3 nacin4 years ago

Replying to caesarsgrunt:

The problem is with lines 1613-1618 of wp-includes/post.php, . . . I don't know what the purpose of these lines is...

I tracked down that code as originating in http://core.trac.wordpress.org/ticket/2390. The excerpt check was added some revisions later.

comment:5 caesarsgrunt4 years ago

  • Keywords commit added

Ah; thanks nacin.

Now, if someone would commit the patch...

comment:6 automattor4 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [12273]) Don't require titles for attachments. Props caesarsgrunt. fixes #11052

Note: See TracTickets for help on using tickets.