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.

Merge of [37729] to the 4.5 branch.

Props kraftbj.
See #36767.
Built from https://develop.svn.wordpress.org/branches/4.5@37732


git-svn-id: http://core.svn.wordpress.org/branches/4.5@37697 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Pascal Birchler 2016-06-16 17:30:55 +00:00
parent c3a292dc76
commit e05facfc58
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.5.3-alpha-37725'; $wp_version = '4.5.3-alpha-37732';
/** /**
* 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.