最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

shortcode - Instagram URL is converted into oEmbed

programmeradmin1浏览0评论

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.

I see the block code in the classic editor which is same as other instagram blocks which render properly but for / it just returns URL.

<!-- wp:core-embed/instagram {"url":"/","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">
    /
</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]/[/embed]

I need help debugging this weired issue

  • /

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/p/BqDzw0CF3pC/ it just returns URL.

<!-- wp:core-embed/instagram {"url":"https://www.instagram/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/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/p/BqDzw0CF3pC/[/embed]

I need help debugging this weired issue

  • http://www.instagram/p/BMY9o6yA6m1
  • http://www.instagram/p/BeqpirDAbol
  • https://www.instagram/p/BqDzw0CF3pC/
Share Improve this question asked Nov 22, 2018 at 8:10 Manoj H LManoj H L 1351 silver badge7 bronze badges 4
  • Looks like a bug. I'd add a bug report to WP Trac... – Krzysiek Dróżdż Commented Nov 22, 2018 at 8:14
  • I tested it in different a different wordpress instance. It works seamlessly. – Manoj H L Commented Nov 22, 2018 at 8:15
  • Any conflicts with other plugins/theme? – Krzysiek Dróżdż Commented Nov 22, 2018 at 8:40
  • Disabled all plugins and tested with 2017 theme. The issue still persists. – Manoj H L Commented Nov 22, 2018 at 8:59
Add a comment  | 

2 Answers 2

Reset to default 2

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.

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/wordpress-oembed/

Hope it helps someone.

发布评论

评论列表(0)

  1. 暂无评论