Created
September 9, 2016 15:08
-
-
Save woodwardtw/cd09dec40403d6f30a5866a7434bcc83 to your computer and use it in GitHub Desktop.
allows a chunk of iframe parameters via wp kses file . . . buyer beware etc.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: iframe allower | |
* Plugin URI: https://gist.github.com/woodwardtw/cd09dec40403d6f30a5866a7434bcc83 | |
* 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