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
This commit is contained in:
Pascal Birchler 2016-06-16 17:18:28 +00:00
parent 0756d8bec7
commit bf3fdc35b3
2 changed files with 5 additions and 1 deletions

View File

@ -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 */ /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
$post_id = apply_filters( 'oembed_request_post_id', $post_id, $url ); $post_id = apply_filters( 'oembed_request_post_id', $post_id, $url );
if ( ! $post_id ) {
return $result;
}
$width = isset( $args['width'] ) ? $args['width'] : 0; $width = isset( $args['width'] ) ? $args['width'] : 0;
$data = get_oembed_response_data( $post_id, $width ); $data = get_oembed_response_data( $post_id, $width );

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @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. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.