blue retractable pen

How to Add/Embed Gists or Github Code in WordPress

Posted by

Initially, I tried adding the Gist URL as a custom HTML

However, that gives an error when you try to save or preview the article (Note: Previewing it using the preview option of the custom HTML block might work fine)

Updating failed. The response is not a valid JSON response.

Instead use the “Shortcode” block, it has the logo ” [/] “

You can either use your Gist’s URL

[gist https://gist.github.com/rahulbanerjee26/87bcbe99f6db521fbdad9a3fa88d7282]
print("Add Gist to Wordpress Post")
view raw __init__.py hosted with ❤ by GitHub

or you an use the Gist ID

[gist 87bcbe99f6db521fbdad9a3fa88d7282]
print("Add Gist to Wordpress Post")
view raw __init__.py hosted with ❤ by GitHub