Skip to content

Instantly share code, notes, and snippets.

@adamsilverstein
Last active April 3, 2024 18:15
Show Gist options
  • Save adamsilverstein/10783774 to your computer and use it in GitHub Desktop.
Save adamsilverstein/10783774 to your computer and use it in GitHub Desktop.
WordPress expanded allowed tags for wp_kses with iframe, forms, etc.
function expanded_alowed_tags() {
$my_allowed = wp_kses_allowed_html( 'post' );
// iframe
$my_allowed['iframe'] = array(
'src' => array(),
'height' => array(),
'width' => array(),
'frameborder' => array(),
'allowfullscreen' => array(),
);
// form fields - input
$my_allowed['input'] = array(
'class' => array(),
'id' => array(),
'name' => array(),
'value' => array(),
'type' => array(),
);
// select
$my_allowed['select'] = array(
'class' => array(),
'id' => array(),
'name' => array(),
'value' => array(),
'type' => array(),
);
// select options
$my_allowed['option'] = array(
'selected' => array(),
);
// style
$my_allowed['style'] = array(
'types' => array(),
);
return $my_allowed;
}
@ikender
Copy link

ikender commented Apr 3, 2024

Thanks @adamsilverstein - great tool, much appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment