Skip to content

Instantly share code, notes, and snippets.

@woodwardtw
Created March 7, 2017 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woodwardtw/f15f4ba2cd0d6218c3ab4397419f5c81 to your computer and use it in GitHub Desktop.
Save woodwardtw/f15f4ba2cd0d6218c3ab4397419f5c81 to your computer and use it in GitHub Desktop.
<?php
/**
* Plugin Name: iframe allower
* Plugin URI: https://github.com/
* Description: allows iframe embed
* Version: .7
* Author: Tom Woodward
* Author URI: http://bionicteaching.com
* License: GPL2
*/
/* 2015 Tom Woodward (email : bionicteaching@gmail.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
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,
'allowfullscreen' => true,
'mozallowfullscreen' => true,
'webkitallowfullscreen' => true,
);
return $allowedposttags;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment