Instagram URL is converted into oEmbed
-
20-04-2021 - |
Pergunta
I have 8 Instagram URLs in this post out of which 3 are not converted into embed/iframes.
I'm using Gutenberg's Instagram embed blog to add the URL's.https://blog.wwf.sg/ocean/2018/11/netflix-documentaries-our-planet-okja-dogs/#
I see the block code in the classic editor which is same as other instagram blocks which render properly but for https://www.instagram.com/p/BqDzw0CF3pC/ it just returns URL.
<!-- wp:core-embed/instagram {"url":"https://www.instagram.com/p/BqDzw0CF3pC/","type":"rich","providerNameSlug":"instagram","className":""} -->
<figure class="wp-block-embed-instagram wp-block-embed is-type-rich is-provider-instagram">
<div class="wp-block-embed__wrapper">
https://www.instagram.com/p/BqDzw0CF3pC/
</div>
</figure>
<!-- /wp:core-embed/instagram -->
I tried using shortcode also it's the same result only the below 3 Instagram posts don't render.
[embed]https://www.instagram.com/p/BqDzw0CF3pC/[/embed]
I need help debugging this weired issue
Solução
Figured it out.
Embed shortcode stores the oemebd data as post meta using md5 hash.
wp-includes/class-wp-embed.php
// Check for a cached result (stored in the post meta)
$key_suffix = md5( $url . serialize( $attr ) );
$cachekey = '_oembed_' . $key_suffix;
$cachekey_time = '_oembed_time_' . $key_suffix;
And has a cache mechanism to fetch new data only after a day.
I deleted the post meta and then it started working.
Outras dicas
I had the same problem, for me the solution was to add this code to theme.
if ( !isset( $content_width ) ) $content_width = 550;
More info https://www.wpexplorer.com/wordpress-oembed/
Hope it helps someone.