• Plugin Author simonpedge

    (@simonpedge)


    To prevent YOUTUBE and VIMEO iFrame code from being stripped out of your slide content, add the following code to your theme’s ‘functions.php‘ file:

    function sa_allow_iframes_filter( $allowedposttags ) {
    
    	// Only change for users who can publish posts
    	if ( !current_user_can( 'publish_posts' ) ) return $allowedposttags;
    
    	// Allow iframes and the following attributes
    	$allowedposttags['iframe'] = array(
    		'align' => true,
    		'width' => true,
    		'height' => true,
    		'frameborder' => true,
    		'name' => true,
    		'src' => true,
    		'title' => true,
    		'allow' => true,
    		'id' => true,
    		'allowfullscreen' => true,
    		'class' => true,
    		'style' => true,
    		'scrolling' => true,
    		'marginwidth' => true,
    		'marginheight' => true,
    	);
    
    	return $allowedposttags;
    }
    add_filter( 'wp_kses_allowed_html', 'sa_allow_iframes_filter' );
  • The topic ‘Allow YOUTUBE & VIMEO iFrames in Slide Content’ is closed to new replies.