WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#20003 closed defect (bug) (fixed)

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

Reported by: batmoo Owned by: 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 9 years ago.
20003.2.diff (1.9 KB) - added by ryan 9 years ago.
Pass post id. Untested.
20003.3.diff (2.1 KB) - added by ryan 9 years ago.
20003-patch.diff (1.7 KB) - added by tott 9 years ago.
Pass post_id to get_upload_iframe_src()

Download all attachments as: .zip

Change History (12)

@batmoo
9 years ago

#1 @batmoo
9 years ago

  • Keywords has-patch added

Patch globalizes $post_ID in the wp_ajax_set_post_thumbnail context.

#2 @danielbachhuber
9 years ago

  • Cc wordpress@… added

#3 @SergeyBiryukov
9 years ago

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

#4 @ryan
9 years ago

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

@ryan
9 years ago

Pass post id. Untested.

@ryan
9 years ago

#5 @ryan
9 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
9 years ago

Much better fix. Thanks.

@tott
9 years ago

Pass post_id to get_upload_iframe_src()

#7 @tott
9 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
9 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.