mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-04 20:54:29 +00:00
Embeds: Fix parsing of post embeds in wp_filter_oembed_result() by appending wp-embed script instead of prepending it in get_post_embed_html().
Due to the way that the `blockquote` and `iframe` are being parsed with a regular expression in `wp_filter_oembed_result()`, if there is any content at all before the `blockquote` start tag then it will fail to be included in the first matching group. By appending the `wp-embed` script instead of prepending it in `get_post_embed_html()`, then the parsing issue is avoided. Also use non-greedy match `wp_maybe_enqueue_oembed_host_js()`. Amends [52132]. Fixes #44632. git-svn-id: https://develop.svn.wordpress.org/trunk@52153 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -300,7 +300,9 @@ class Tests_Embed_Template extends WP_UnitTestCase {
|
||||
$actual = get_post_embed_html( 200, 200, $post_id );
|
||||
$actual = preg_replace( '/secret=("?)\w+\1/', 'secret=__SECRET__', $actual );
|
||||
|
||||
$this->assertStringEndsWith( $expected, $actual );
|
||||
$this->assertStringStartsWith( '<blockquote class="wp-embedded-content" data-secret=__SECRET__>', $actual );
|
||||
$this->assertStringContainsString( $expected, $actual );
|
||||
$this->assertStringEndsWith( '</script>', trim( $actual ) );
|
||||
}
|
||||
|
||||
/** @covers ::wp_oembed_add_host_js() */
|
||||
|
||||
Reference in New Issue
Block a user