Opened 12 years ago
Closed 12 years ago
#24070 closed defect (bug) (fixed)
[embed] from structured video/audio post format not working with post_formats_compat.
Reported by: | jbobich | Owned by: | markjaquith |
---|---|---|---|
Milestone: | 3.6 | Priority: | normal |
Severity: | normal | Version: | 3.6 |
Component: | Post Formats | Keywords: | has-patch |
Focuses: | Cc: |
Description
When using a theme that relies on post_formats_compat for video and audio posts (Twenty Twelve currently for example) --
If the user puts a video/audio file URL in through the new post formats UI with not video in the content of the page, the media will not embed properly within the final output of the_content()
.
Attachments (4)
Change History (13)
#3
@
12 years ago
Yup. I'm using latest trunk version with TwentyTwelve with no plugins installed. Can you not reproduce?
For example, I have a post setup like this:
http://www.uploadblvd.com/uploads/image_5168921c85b8c.png
Before my patch, it displays like this:
http://www.uploadblvd.com/uploads/image_516891bd6f206.png
After, it displays as you'd expect:
#4
@
12 years ago
- Milestone changed from Awaiting Review to 3.6
I see it now, that is really bizarre
#5
@
12 years ago
This is interesting, and not limited to post formats, but the [embed]
shortcode with audio and video files. The problem lies within the WP_Embed->shortcode
method, which calls the wp_audio_embed
and wp_video_embed
functions, both of which return the URL, and not the embedded media, because WP_Embed->shortcode
runs when all other shortcodes are not registered yet.
The reason it "works" is that the resulting URL is picked up by WP_Embed->autoembed
and parsed again using wp_audio_embed
or wp_video_embed
, so if there's anything else on the same line that doesn't match the audio/video regexes, it fails. Even worse is when the resulting URL contains a </div>
like in the content produced by the audio/video formats compat code. This breaks the theme's markup because both embed handlers don't escape the URL.
24070.2.diff makes both embed handlers return the (undone) shortcode, regardless of whether the shortcode has been registered or not.
#6
follow-up:
↓ 7
@
12 years ago
@kovshenin -- Awesome, that definitely solves it.
Is there a reason why wp_audio_embed
and wp_video_embed
need to parse the shorcodes to begin with (i.e. before 24070.2.diff)? Meaning, does removing that functionality and just allowing the shortcodes to be parsed along with everything else later on effect anything else?
#7
in reply to:
↑ 6
@
12 years ago
Replying to jbobich: The functions don't do any shortcode parsing, they're callbacks for WP_Embed
, meaning you can insert a URL to an .mp3 file on a line by itself, and WordPress will figure it out and embed it in an audio player, sort of how you can insert links to YouTube videos or tweets (though that's a tiny bit different).
Apologies, what I meant to say was --
"If the user puts a video/audio file URL in through the new post formats UI with no embed in the content of the page, the media will not embed properly within the final output of
the_content()
."