add_filter( 'wp_kses_allowed_html', 'esw_author_cap_filter',1,1 ); function esw_author_cap_filter( $allowedposttags ) { //Here put your conditions, depending your context if ( !current_user_can( 'publish_posts' ) ) return $allowedposttags; // Here add tags and attributes you want to allow $allowedposttags['iframe']=array( 'align' => true, 'width' => true, 'height' => true, 'frameborder' => true, 'name' => true, 'src' => true, 'id' => true, 'class' => true, 'style' => true, 'scrolling' => true, 'marginwidth' => true, 'marginheight' => true, ); return $allowedposttags; }
Let us know if this snippet is not working for you:
This snippet doesn’t work