Skip to content

Instantly share code, notes, and snippets.

@johnss
Created April 19, 2019 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnss/a2e82b49b0fc80224adbfb616b57436c to your computer and use it in GitHub Desktop.
Save johnss/a2e82b49b0fc80224adbfb616b57436c to your computer and use it in GitHub Desktop.
Wordpress Embed Add Openload
<?php
function wp_embed_handler_openload($matches, $attr, $url, $rawattr)
{
$embed = sprintf(
'<iframe src="https://openload.co/embed/%s" scrolling="no" frameborder="0" width="700" height="430" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true">></iframe>',
esc_attr($matches[1])
);
return apply_filters('embed_openload', $embed, $matches, $attr, $url, $rawattr);
}
<?php
add_action('init', function()
{
wp_embed_register_handler(
'openload',
'#https://www\.openload\.co/f/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_.-]+)?#i',
'wp_embed_handler_openload'
);
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment