Opened 8 years ago
Closed 8 years ago
#24347 closed defect (bug) (invalid)
get_the_post_format_image() should use filtered content for image extraction
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.6 |
Component: | Post Formats | Keywords: | |
Focuses: | Cc: |
Description
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)
Change History (6)
#3
@
8 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
@
8 years ago
Chatted briefly on IRC, needs a little bit more thought.
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 withinget_the_post_format_image()
.