Skip to content

Instantly share code, notes, and snippets.

@tzkmx
Created June 23, 2016 22:45
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 tzkmx/dc28bd892231789f818115cf81bc0c26 to your computer and use it in GitHub Desktop.
Save tzkmx/dc28bd892231789f818115cf81bc0c26 to your computer and use it in GitHub Desktop.
Minimal shortcode to override WordPress virtual ban of iframes
<?php
function iframe_render_shortcode($atts) {
$keys = array_flip(array_keys($atts));
$params = shortcode_atts($keys, $atts);
$out = [];
foreach($params as $key => $val) {
$out[] = $key . '="' . $val . '"';
}
return '<iframe ' . implode(' ', $out) . '></iframe>';
}
add_shortcode('iframe', 'iframe_render_shortcode');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment