diff --git a/wp-includes/class-wp-embed.php b/wp-includes/class-wp-embed.php index 5f22e92a5c..888dcd33da 100644 --- a/wp-includes/class-wp-embed.php +++ b/wp-includes/class-wp-embed.php @@ -334,8 +334,12 @@ class WP_Embed { // Replace line breaks from all HTML elements with placeholders. $content = wp_replace_in_html_tags( $content, array( "\n" => '' ) ); - // Find URLs that are on their own line. - $content = preg_replace_callback( '|^(\s*)(https?://[^\s"]+)(\s*)$|im', array( $this, 'autoembed_callback' ), $content ); + if ( preg_match( '#(^|\s|>)https?://#i', $content ) ) { + // Find URLs on their own line. + $content = preg_replace_callback( '|^(\s*)(https?://[^\s<>"]+)(\s*)$|im', array( $this, 'autoembed_callback' ), $content ); + // Find URLs in their own paragraph. + $content = preg_replace_callback( '|(
]*)?>\s*)(https?://[^\s<>"]+)(\s*<\/p>)|i', array( $this, 'autoembed_callback' ), $content ); + } // Put the line breaks back. return str_replace( '', "\n", $content ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 391d4949e2..388123bdd9 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.6-alpha-37626'; +$wp_version = '4.6-alpha-37627'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.