From bf3fdc35b356dce21178703f4a4b8eb88aff27cf Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Thu, 16 Jun 2016 17:18:28 +0000 Subject: [PATCH] Embeds: Enforce a valid post ID when embedding a post from the current site. Otherwise `wp_filter_pre_oembed_result()` could erroneously return the HTML of the current post instead of the intended result. Props kraftbj. See #36767. Built from https://develop.svn.wordpress.org/trunk@37729 git-svn-id: http://core.svn.wordpress.org/trunk@37695 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/embed.php | 4 ++++ wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/wp-includes/embed.php b/wp-includes/embed.php index 68536434cb..7d462e8e92 100644 --- a/wp-includes/embed.php +++ b/wp-includes/embed.php @@ -1100,6 +1100,10 @@ function wp_filter_pre_oembed_result( $result, $url, $args ) { /** This filter is documented in wp-includes/class-wp-oembed-controller.php */ $post_id = apply_filters( 'oembed_request_post_id', $post_id, $url ); + if ( ! $post_id ) { + return $result; + } + $width = isset( $args['width'] ) ? $args['width'] : 0; $data = get_oembed_response_data( $post_id, $width ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 2689ec44b0..cf075f00e7 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.6-alpha-37728'; +$wp_version = '4.6-alpha-37729'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.