Support » Fixing WordPress » Unable to embed GitHub Gist

  • Recently I have updated WordPress to version 5.0 for my test site. Unfortunately, I find out that I could not embed GitHub Gist using Gutenberg directly unless using HTML block. Does Gutenberg not support GitHub Gist?

    Because, before this, I can still embed on my website which is still 4.9.8. And I also can embed in WordPress 5.0 if using classic editor plugin. I’m pretty sure there is no plugin conflict since I have no other plugin on my test site aside from Jetpack. And I did deactivate Jetpack but still not fixing my issue.

    View my Screenshot.

    • This topic was modified 5 days, 7 hours ago by  Shah Ahmad Yusof. Reason: Add screenshot
Viewing 12 replies - 1 through 12 (of 12 total)
  • I can recreate the same – on my primary site, running 4.9.8 and Gutenberg, I can embed Gists just fine. On a test site, running 5.0, Gists do not embed or display.

    I’ll get this logged as a Trac ticket (unless I can find an existing one) and add the details back here so that you can track the progress.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Github gist’s doesn’t have any oembed headers on their page. They are not embeddable in any version, as far as I can tell.

    You can use their script code to embed, sure. But without oembed headers, WordPress does not know how to embed them directly via the URL alone.

    @otto42 Perhaps screenshots below can help you understand what I mean.

    Embedded gist in WordPress 4.9.8 (Visual editor) : Screenshot.
    Embedded gist in WordPress 4.9.8 (Gutenberg plugin) : Screenshot.
    Embedded gist in WordPress 5.0 (Classic editor plugin) : Screenshot.
    Embedded gist in WordPress 5.0 (Core Gutenberg editor) : Screenshot.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Yes, I know what a gist looks like.

    But you’re trying to use the “Embed” block to embed a gist. That won’t work. WordPress does not have any built in support for embedding gists.

    You’re confusing two different things here, basically. WordPress supports a standard called “oembed”. In the old editor, this worked by the simple method of taking a URL and pasting it on it’s own line in the editor. WordPress would read the URL, go fetch some information from it, and convert it into an embedded thing on the site.

    Gist, from github, does not implement the oEmbed standard. You cannot use WordPress, any version, to embed Gist URLs using oEmbed, because that doesn’t exist for them.

    However, gist has their own embed code, which you can copy and paste. It’s a script thing. Looks like this:
    <script src="https://gist.github.com/Otto42/example.js"></script>

    Now, that works just fine in WordPress. But it’s not an “embed” as defined by WordPress. So you can’t use the Embed Block for it. You can use an HTML block, or the Classic block, and that script code will work just fine.

    But the embed block only works for URLs that have implemented oEmbed support, and Gist has not implemented that support.

    @otto42 Let me say this in a very simple way. I can embed directly on Gutenberg editor by pasting gist URL using WordPress 4.9.8. Yes, URL ONLY not including <script></script>.

    Now, if I paste gist URL on Gutenberg editor 5.0, nothing happened. This is why I can’t understand. Why before this I can embed on Gutenberg plugin (4.9.8) but now I cannot embed in Gutenberg 5.0 unless something changed.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    I can embed directly on Gutenberg editor by pasting gist URL using WordPress 4.9.8. Yes, URL ONLY not including <script></script>.

    Not without a plugin, you can’t. WordPress literally does not have any support for that.

    Now, are you using Jetpack? Because it does have support for gists, in the form of a shortcode and an embed handler. Maybe that plugin has an issue of some kind?

    @otto42

    Not without a plugin, you can’t. WordPress literally does not have any support for that.

    Yes I’m using Oembed Gist plugin. It works on WordPress 4.9.8 using Gutenberg editor plugin. But stopped working on WordPress 5.0 only on Gutenberg editor (Classic editor still working).

    Now, are you using Jetpack? Because it does have support for gists, in the form of a shortcode and an embed handler. Maybe that plugin has an issue of some kind?

    I don’t think this is related because I tested it 7-8 times on WordPress 4.9.8 (Gutenberg + Visual editor). It works with or without Jetpack (I disable + delete jetpack to test.)

    I also tested on WordPress 5.0 with and without Jetpack. Only Classic Editor is working to embed.

    Now this is funny thing I found just now
    I try installing Gutenberg plugin in WordPress 5.0 which mean I have 2 Gutenbergs in my core and plugin. And tadaa! I CAN EMBED github gist directly again like before.. Any explanation?

    @otto42 Seriously I do not know why you keep updating this ticket as “Resolved”. This is the third time I believe. This issue is still not resolved unless you believe the update to 5.0 and using the Gutenberg plugin at the same time is the permanent resolution of my issue. Or is it just WordPress admin who has “rights” to mark any tickets as resolved?

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    I marked it as resolved because you said you fixed the problem. One time. That’s it. If you have fixed your problem, then, you know, moving on.

    Ah, I see. I did not expect that you would consider my “workaround” as a permanent solution. I was hoping that you will see my “workaround” as a comparison between Gutenberg core and Gutenberg plugin. And since you are very famous, have vast knowledge about WordPress and also an Admin, perhaps you can do something about it. Sorry, but my issue is still not fixed yet.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    No, there’s no need for a “fix” in the editor. The problem isn’t in the editor.

    Your gist embeds plugin clearly needs an update to support the final editor instead of just supporting the older Gutenberg plugin. You should be posting in that plugin’s support forum, and seeing if the gist embed plugin can be fixed.

Viewing 12 replies - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.