Skip to content

Instantly share code, notes, and snippets.

@hmorv
Forked from bueltge/fb_allow_iframe_tinymce.php
Created March 11, 2016 11:33
Show Gist options
  • Save hmorv/fd1c7c040e8ce1d1b35e to your computer and use it in GitHub Desktop.
Save hmorv/fd1c7c040e8ce1d1b35e to your computer and use it in GitHub Desktop.
Wordpress plugin for allow iframe in the visual Editor
<?php
/**
* Plugin Name: iFrame for TinyMCE
* Description: Allow iframe in the visual Editor
* Version: 0.0.1
* Author: Frank Bültge
* Author URI: http://bueltge.de/
*/
! defined( 'ABSPATH' ) and exit;
add_filter( 'tiny_mce_before_init', 'fb_change_mce_options' );
function fb_change_mce_options( $args ) {
// Comma separated string od extendes tags
// Command separated string of extended elements
$ext = 'iframe[align|longdesc|name|width|height|frameborder|scrolling|marginheight|marginwidth|src]';
if ( isset( $args['extended_valid_elements'] ) ) {
$args['extended_valid_elements'] .= ',' . $ext;
} else {
$args['extended_valid_elements'] = $ext;
}
// maybe; set tiny paramter verify_html
//$args['verify_html'] = false;
return $args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment