Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#20003 closed defect (bug) (fixed)

Removing a featured image breaks the ability to set a featured image

Reported by: batmoo's profile batmoo Owned by: ryan's profile ryan
Milestone: 3.4 Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch
Focuses: Cc:

Description (last modified by SergeyBiryukov)

Repro steps:

  • Create a new post
  • Upload an image and set it as the featured image
  • Click on "Remove featured image"
  • Click on "Add featured image"
  • The Gallery tab isn't shown. Neither is the "Set featured image" for any uploaded images.

Problem is that in wp_ajax_set_post_thumbnail, the $post_ID variable isn't globalized, which _wp_post_thumbnail_html expects.

Related to the ajax re-org #15327 -- other things are possibly broken as well.

Attachments (4)

20003.diff (573 bytes) - added by batmoo 12 years ago.
20003.2.diff (1.9 KB) - added by ryan 12 years ago.
Pass post id. Untested.
20003.3.diff (2.1 KB) - added by ryan 12 years ago.
20003-patch.diff (1.7 KB) - added by tott 12 years ago.
Pass post_id to get_upload_iframe_src()

Download all attachments as: .zip

Change History (12)

12 years ago

#1 @batmoo
12 years ago

  • Keywords has-patch added

Patch globalizes $post_ID in the wp_ajax_set_post_thumbnail context.

#2 @danielbachhuber
12 years ago

  • Cc wordpress@… added

#3 @SergeyBiryukov
12 years ago

  • Description modified (diff)
  • Milestone changed from Awaiting Review to 3.4

#4 @ryan
12 years ago

Hmmm, how about a post ID arg for _wp_post_thumbnail_html() ?

12 years ago

Pass post id. Untested.

12 years ago

#5 @ryan
12 years ago

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

In [19902]:

Add post ID argument to _wp_post_thumbnail_html() rather than relying on a global. Post the ID from wp_ajax_set_post_thumbnail(). Props batmoo. fixes #20003

#6 @batmoo
12 years ago

Much better fix. Thanks.

12 years ago

Pass post_id to get_upload_iframe_src()

#7 @tott
12 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

The post_id needs to be passed to get_upload_iframe_src() as well. See attached patch as proposal.

#8 @ryan
12 years ago

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

In [19999]:

Pass post id to get_upload_iframe_src() instead of relying on a global. Props tott. fixes #20003

Note: See TracTickets for help on using tickets.