Skip to content

Instantly share code, notes, and snippets.

@zgordon
Created June 15, 2015 04:45
Show Gist options
  • Save zgordon/1fbec6fffc2e9888e332 to your computer and use it in GitHub Desktop.
Save zgordon/1fbec6fffc2e9888e332 to your computer and use it in GitHub Desktop.
oEmbed Gist into WordPress
wp_embed_register_handler(
'github-gist',
'/https:\/\/gist\.github\.com\/([^\/]+)\/([^\/]+)/',
function($matches, $attr, $url, $rawattr) {
$embed = "<script src=\"{$url}.js\"></script>";
return apply_filters(
'embed_github_gist',
$embed,
$matches,
$attr,
$url,
$rawattr
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment