Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#22672 closed defect (bug) (fixed)

Edit Media Page: Title Field Has No Value

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

Description

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 14 years ago.
22672.diff​ (1.2 KB ) - added by nacin 14 years ago.

Download all attachments as: .zip

Change History (7)

#1 @miqrogroove
14 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
14 years ago

  • Keywords has-patch added

#3 @nacin
14 years ago

  • Keywords has-patch removed
  • Milestone Awaiting Review → 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
14 years ago

  • Owner set to nacin
  • Status new → assigned

#5 @ryan
14 years ago

  • Resolution → fixed
  • Status assigned → 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.