From 094ef5ce72f3bcf4fa9ddf0f9ce1e4dac41d686f Mon Sep 17 00:00:00 2001 From: AmitPaul-akp <95674193+AmitPaul-akp@users.noreply.github.com> Date: Tue, 26 May 2026 20:38:16 +0600 Subject: [PATCH] fix: drop stale upstream error in Gutenberg embed response (fbs-82016) WP core's oEmbed discovery resolves facebook.com/reel/{id} URLs to the Graph API endpoint, which then fails with "Provide valid app ID" when no FB app token is configured. The OAuth error gets merged into the response object alongside the valid iframe HTML produced by Embera's local Facebook provider fallback. The Gutenberg block JS rejects any response with an `error` field even when `embed` is populated, so the editor shows "Sorry, we could not embed that content." Elementor's widget consumes the server- rendered `embed` directly and has no such guard, which is why the same URL renders there. Strip `error` from the merged response when the fallback produced real embed HTML (iframe / embed / script / blockquote / video / object). No behaviour change for any provider where `error` wasn't present, and the fallback iframe itself is unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) --- EmbedPress/Shortcode.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/EmbedPress/Shortcode.php b/EmbedPress/Shortcode.php index dffd80fb..847e7e0e 100644 --- a/EmbedPress/Shortcode.php +++ b/EmbedPress/Shortcode.php @@ -578,7 +578,16 @@ public static function parseContent($subject, $stripNewLine = false, $customAttr // Get provider name using Helper method $provider_name = Helper::get_provider_name($url); - $embed = (object) array_merge((array) $urlData, [ + $urlDataArr = (array) $urlData; + // Drop upstream provider errors when the fallback produced a + // real embed. FB reel URLs surface a Graph API OAuth error via + // WP core's oEmbed, and the Gutenberg block rejects responses + // that carry an `error` field even when `embed` is valid. + if (isset($urlDataArr['error']) && preg_match('~<(iframe|embed|script|blockquote|video|object)\b~i', $parsedContent)) { + unset($urlDataArr['error']); + } + + $embed = (object) array_merge($urlDataArr, [ 'attributes' => (object) self::get_oembed_attributes(), 'embed' => $parsedContent, 'url' => $url,