Home>Support>Can I shut off the filter that is removing an iframe?

Can I shut off the filter that is removing an iframe?

Thanks for making such a great plug-in.

I am attempting to run an iframe inside a text area of a hero image item. I tried using the wpautop control plug-in to turn off filtering, but this did not work for me.

Any ideas?

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 7 years, 8 months ago Alex S
    Hi, I Work Here

    Hi Moraitis,

    Please install the Code Snippets plugin (or use a child theme) and then please navigate to WP AdminSnippetsAdd New and add the following PHP:

    Let me know if this helps.

  2. 7 years, 8 months ago moraitis

    Thanks Alex!

    The code worked great. As a work-around I was putting the iFrame inside of a plain old text widget. But now I can have the iFrame inside a hero image that is in a sequence.

    I added a couple more tags to get the effect I was looking for:

    /**
    * Add iFrame to allowed wp_kses_post tags
    *
    * @param string $tags Allowed tags, attributes, and/or entities.
    * @param string $context Context to judge allowed tags by. Allowed values are 'post',
    *
    * @return mixed
    */
    function custom_wpkses_post_tags( $tags, $context ) {
    	if ( 'post' === $context ) {
    		$tags['iframe'] = array(
    			'src'             => true,
    			'height'          => true,
    			'width'           => true,
    			'frameborder'     => true,
    			'allowfullscreen' => true,
    			'style' => true,
    			'marginwidth' => true,
    			'marginheight' => true,
    			'vspace' => true,
    			'hspace' => true,
    			'allowtransparency' => true,
    			'scrolling' => true,
    		);
    	}
    	return $tags;
    }
    add_filter( 'wp_kses_allowed_html', 'custom_wpkses_post_tags', 10, 2 );

    Thanks again for your help. The SiteBuilder plug-in is great!

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More