WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#13033 closed defect (bug) (fixed)

"Use as featured image" not showing after deleting featured image

Reported by: alexmglover Owned by:
Milestone: 3.0 Priority: high
Severity: normal Version: 3.0
Component: Media Keywords: has-patch
Focuses: Cc:

Description

If a featured image is deleted, and then "Set Featured Image" is clicked, "Use as featured image" option is not available. In order for "Use as featured image" to show up, "Update" needs to be clicked to save the post/page without a Featured Image, then upon clicking "Set Featured Image" the option becomes available. I am not sure if this is intended behavior, but it seemed like a bug to me.

Attachments (2)

please_do_cap.diff (409 bytes) - added by PotterSys 5 years ago.
'Cause post_id != post_ID
from_id_to_ID.diff (1.0 KB) - added by PotterSys 5 years ago.
A more elegant solution: changing the name for the whole case

Download all attachments as: .zip

Change History (4)

@PotterSys5 years ago

'Cause post_id != post_ID

comment:1 @PotterSys5 years ago

  • Keywords has-patch added
  • Milestone changed from Unassigned to 3.0
  • Priority changed from normal to high

I could trace the problem to admin-ajax.php. The function that creates the link for the upload has a global $post_ID. However, the set-post-thumbnail case have a $post_id (yes, 2 different variable names).

As a first attempt to fix it, just adding $post_ID = $post_id; below line 1465 fixes the bug. Another option (way more cool) is changing the variable name in set-post-thumbnail; but there's no clue if this bug could flip (ie. : another function has global $post_id)

@PotterSys5 years ago

A more elegant solution: changing the name for the whole case

comment:2 @markjaquith5 years ago

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

(In [14731]) Correctly set Featured Post Image link after removing/updating. fixes #13033. props PotterSys

Note: See TracTickets for help on using tickets.