Brain Brian

software engineer living in Los Angeles, California.

Fix for WordPress stripping iFrames and Script Tags from Editor

June 04, 2014

If you're frustrated with WordPress's TinyMCE Editor stripping out your iFrame or script tags within your posts add the following line of code to your functions file: [cc lang="php" tabsize="4"] // allow script & iframe tag within posts function allowposttags( $allowedposttags ){ $allowedposttags['script'] = array( 'type' => true, 'src' => true, 'height' => true, 'width' => true, ); $allowedposttags['iframe'] = array( 'src' => true, 'width' => true, 'height' => true, 'class' => true, 'frameborder' => true, 'webkitAllowFullScreen' => true, 'mozallowfullscreen' => true, 'allowFullScreen' => true ); return $allowedposttags; } addfilter('wpksesallowedhtml','allowpost_tags', 1); [/cc] I'm not sure when this became an issue, but I'm running WordPress 3.9 and I didn't notice this until now.

© 2021 Brain Brian (Brian Behrens) – Powered by coffee, froth, salt water and curiosity – brainbrian.com