Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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;
}
@ckanitz

This comment has been minimized.

Copy link

ckanitz commented Apr 6, 2017

just want to leave a "thank you" for this :)

@adamsilverstein

This comment has been minimized.

Copy link
Owner Author

adamsilverstein commented Aug 10, 2017

Glad you found it useful @ckanitz!

@Ninetheme

This comment has been minimized.

Copy link

Ninetheme commented Dec 7, 2017

awesome!

@genetech-ahmed

This comment has been minimized.

Copy link

genetech-ahmed commented Apr 11, 2018

Thanks. Saved my day! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.