get_error_code() || '/oembed/1.0/proxy' !== $request->get_route() ) { return $response; } // Try using a classic embed instead. global $wp_embed; $html = $wp_embed->shortcode( array(), $_GET['url'] ); if ( ! $html ) { return $response; } global $wp_scripts; // Check if any scripts were enqueued by the shortcode, and include them in // the response. $enqueued_scripts = array(); foreach ( $wp_scripts->queue as $script ) { $enqueued_scripts[] = $wp_scripts->registered[ $script ]->src; } return array( 'provider_name' => __( 'Embed Handler', 'gutenberg' ), 'html' => $html, 'scripts' => $enqueued_scripts, ); } add_filter( 'rest_request_after_callbacks', 'gutenberg_filter_oembed_result', 10, 3 );