Make WordPress Core

Opened 15 years ago

Closed 15 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
Priority: normal Milestone: 3.4
Component: General Version:
Severity: normal Keywords: has-patch
Cc: Focuses:

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

Download all attachments as: .zip

Change History (12)

@batmoo
15 years ago

#1 @batmoo
15 years ago

  • Keywords has-patch added

Patch globalizes $post_ID in the wp_ajax_set_post_thumbnail context.

#2 @danielbachhuber
15 years ago

  • Cc wordpress@… added

#3 @SergeyBiryukov
15 years ago

  • Description modified (diff)
  • Milestone Awaiting Review → 3.4

#4 @ryan
15 years ago

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

@ryan
15 years ago

Pass post id. Untested.

@ryan
15 years ago

#5 @ryan
15 years ago

  • Owner set to ryan
  • Resolution → fixed
  • Status new → 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
15 years ago

Much better fix. Thanks.

@tott
15 years ago

Pass post_id to get_upload_iframe_src()

#7 @tott
15 years ago

  • Resolution fixed
  • Status closed → reopened

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

#8 @ryan
15 years ago

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