This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

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

9 years ago · Last reply by moraitis 9 years ago

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.

Need fast email support? Get SiteOrigin Premium

Replies

2
  1. Alex S Staff 9 years, 1 month ago

    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. moraitis 9 years, 1 month ago

    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.

Have a different question or issue?

Start New Thread