Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#24347 closed defect (bug) (invalid)

get_the_post_format_image() should use filtered content for image extraction

Reported by: ethitter's profile ethitter Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.6
Component: Post Formats Keywords:
Focuses: Cc:


Any plugin that modifies image paths through the image_downsize and the_content filters prevents get_the_post_format_image() from properly removing the first parsed image from the content later passed to get_the_remaining_content().

When get_the_post_format_image() parses post content to extract an image, the content is accessed directly from the $post global without applying the the_content filter. In the case of a user with a CDN plugin such as Jetpack Photon enabled, this causes the string replacement meant to strip out the first image to fail because the image path returned by wp_get_attachment_image_src() is modified through the image_downsize filter. Since the corresponding filter hooked to the_content hasn't modified the content the string replacement is applied to, the parsed image isn't removed from the content.

Attachments (1)

24347.patch (1.4 KB) - added by ethitter 11 years ago.

Download all attachments as: .zip

Change History (6)

#1 @ethitter
11 years ago

Worth noting that if we do apply the_content, we'll want to unhook the shortcode parsing functions so we don't break the existing shortcode handling within get_the_post_format_image().

11 years ago

#2 @kovshenin
11 years ago

  • Cc kovshenin added

#3 @kovshenin
11 years ago

I'm not convinced that it's a good idea to pass the image meta through the_content, especially since you never know what other filters it might run through. Is there a way one could do the CDN URL replacement at a later stage. Can we help with a filter?

#4 @kovshenin
11 years ago

Chatted briefly on IRC, needs a little bit more thought.

#5 @nacin
11 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.