Commit 7fe59d007c for wordpress.org
commit 7fe59d007c9fab9ec2469ae8d248d31529a8754d
Author: johnbillion <johnbillion@git.wordpress.org>
Date: Wed Nov 18 13:15:45 2026 +0000
Embeds: Return scripts from the oEmbed proxy only for embed handlers.
Props jonsurrell, jsnajdr, jeryj.
Built from https://develop.svn.wordpress.org/trunk@65572
git-svn-id: http://core.svn.wordpress.org/trunk@64645 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/class-wp-oembed-controller.php b/wp-includes/class-wp-oembed-controller.php
index d78a76d885..65e131f390 100644
--- a/wp-includes/class-wp-oembed-controller.php
+++ b/wp-includes/class-wp-oembed-controller.php
@@ -176,6 +176,10 @@ final class WP_oEmbed_Controller {
$cache_key = 'oembed_' . md5( serialize( $args ) );
$data = get_transient( $cache_key );
if ( ! empty( $data ) ) {
+ // Only embed handlers return scripts, and their responses are not cached.
+ if ( is_object( $data ) ) {
+ unset( $data->scripts );
+ }
return $data;
}
@@ -222,6 +226,11 @@ final class WP_oEmbed_Controller {
return new WP_Error( 'oembed_invalid_url', get_status_header_desc( 404 ), array( 'status' => 404 ) );
}
+ // Only embed handlers return scripts.
+ if ( is_object( $data ) ) {
+ unset( $data->scripts );
+ }
+
/** This filter is documented in wp-includes/class-wp-oembed.php */
$data->html = apply_filters( 'oembed_result', _wp_oembed_get_object()->data2html( (object) $data, $url ), $url, $args );
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 1b16ef855b..0edb4400ae 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.2-RC1-65571';
+$wp_version = '7.2-RC1-65572';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.