Skip to content

Instantly share code, notes, and snippets.

@moxdev
Created March 7, 2018 17:25
Show Gist options
  • Save moxdev/243ff8d7bc6f11bc828ad3b655ffe03b to your computer and use it in GitHub Desktop.
Save moxdev/243ff8d7bc6f11bc828ad3b655ffe03b to your computer and use it in GitHub Desktop.
Add Custom Allowed Tags to WordPress Function File
if(!function_exists('custom_add_allowed_tags')) {
function custom_add_allowed_tags($tags) {
// iframe
$tags['iframe'] = array(
'src' => array(),
'height' => array(),
'width' => array(),
'frameborder' => array(),
'allowfullscreen' => array(),
);
// form fields - input
$tags['input'] = array(
'class' => array(),
'id' => array(),
'name' => array(),
'value' => array(),
'type' => array(),
);
// select
$tags['select'] = array(
'class' => array(),
'id' => array(),
'name' => array(),
'value' => array(),
'type' => array(),
);
// select options
$tags['option'] = array(
'selected' => array(),
);
// style
$tags['style'] = array(
'types' => array(),
);
return $tags;
}
add_filter('wp_kses_allowed_html', 'custom_add_allowed_tags');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment