WordPress Gutenberg doesn’t parse Istagram oembed url

Sometimes Instagram embed doesn’t work, why?

November 4, 2019

This problem probably isn’t related to the new Gutenberg text editor, which is fantastic (the name comes from the inventor of the printing technique), but probably is related to another cause:

Broken Instagram oembed {{unknown}} in database

If you doesn’t see the embed but you see only the URL of the Instagram embed, it means that WordPress doesn’t modify your code to add the Instagram embed. You can see if in your database in the table wp_postmeta you have some broken oembed code for your post (use the post_id to find the value). If this is your problem you will see meta_value for that field which contains the string {{unknown}}. Remove the record to fix the problem.

You’ve changed the_content in get_the_content

If you write your theme maybe you would like to perform some string changes in your contents, and to make the changes you’ve just modified the_content() in $content=get_the_content(); and made your changes to $content. This change blocks your oembed content rendering, which is made during the application of some filters that happens inside the_content() function.

So to fix the problem and keep doing your stuff in $content string you should make:

$content = get_the_content();
// perform something on $content string
$content = apply_filters("the_content",$content);

Pay attention that the apply_filters modifies the html. So if you performs some changes between the two lines you could prevent apply_filters to work, for example if you modify the Instagram url.

On the other side, if you perform something on $content string after the apply_filters remember that after that line the HTML is changed and it will contain the Instagram embed code.

A plugin made some bad things

If your oembed problem doesn’t belong to the first two points, you probably have a conflict with a plugin which performs something on your content. Have you checked your plugins?

Author

I'm a software engineer, an everyday web developer and a maker. I usually build sites with PHP, within or without WordPress. I build Internet of Things with Arduino and ESP8266. I'm the founder of Rockit.it and Dailybest.it and I'm actually the Chief Technical Officer of Better Days web agency.

Comments on “WordPress Gutenberg doesn’t parse Istagram oembed url”

Leave a Reply

Your email address will not be published. Required fields are marked with an *

Recommended

Two post types share the same taxonomy in WordPress

Sharing a taxonomy between two post types is useful especially if you want to create a relation between different items…

November 14, 2019

Modify the language attribute based on category in WordPress

How to modify the language attribute in your Wordpress theme using a specific value

November 7, 2019

WordPress Fatal error: Unknown: Cannot use output buffering in output buffering display handlers in Unknown on line 0

How I've beat the php mysterious fatal error unknown in Wordpress caused by caching plugin WP Fastest Cache

Stop sending email to new user in WordPress admin registration

A code snippet to prevent WordPress to send notification emails when you manually create new users. It uses a pluggable function.

November 1, 2019

A new avatar generator for WordPress with get_avatar and Flathash

Brand new avatars for WordPress Gravatar service

April 7, 2017

3 ways to add author’s image in WordPress

Add author's image in WordPress without a plugin

April 5, 2017