Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#22672 closed defect (bug) (fixed)

Edit Media Page: Title Field Has No Value

Reported by: miqrogroove Owned by: nacin
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.5
Component: Media Keywords:
Focuses: Cc:


Although the images in the Media Library all have titles, after clicking the Edit link, the Edit Media page is always displayed with a blank title field at the top. The HTML contains a null string for the value attribute.

<input type="text" name="post_title" size="30" value="" id="title" autocomplete="off" />

Found in 3.5-RC2-22958.

Attachments (2)

miqro-22672.patch (487 bytes) - added by miqrogroove 8 years ago.
22672.diff (1.2 KB) - added by nacin 8 years ago.

Download all attachments as: .zip

Change History (7)

#1 @miqrogroove
8 years ago

The fix is actually simple. Because 3.5 is using post.php to edit attachments now, it runs into the same code that was handling "Auto Draft" posts, which can be found in the Media Library for images uploaded to posts that weren't saved. It's possible to edit that post, so there's a line of code that says to blank out the "Auto Draft" value of the title when editing that post.

My patch checks to make sure the "post" object being edited is not an attachment. There are many other possible solutions, as there are many ways to distinguish auto-draft posts and the attachments thereof.

see miqro-22672.patch​

#2 @miqrogroove
8 years ago

  • Keywords has-patch added

#3 @nacin
8 years ago

  • Keywords has-patch removed
  • Milestone changed from Awaiting Review to 3.5

I think the changes from $post->post_status to get_post_status() may simply have been in error in [21948].

I had made an adjustment in ticket:21391:attachment-show-ui.diff moving to get_post_status(), and it may have needed to get propagated elsewhere, but definitely not for these auto-draft checks.

#4 @nacin
8 years ago

  • Owner set to nacin
  • Status changed from new to assigned

8 years ago

#5 @ryan
8 years ago

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

In 22963:

Directly access post_status instead of using get_post_status() when checking for auto-draft status. Attachments with their inherit post_status were getting the auto-draft status of their parent when using get_post_status(). This caused some things to display improperly on the edit attachment page.

Props nacin, miqrogroove
fixes #22672

Note: See TracTickets for help on using tickets.