Skip to content

Instantly share code, notes, and snippets.

@DevWael
Created November 19, 2019 16:11
Show Gist options
  • Save DevWael/debeef764b4aeacd91c94294aaf4e623 to your computer and use it in GitHub Desktop.
Save DevWael/debeef764b4aeacd91c94294aaf4e623 to your computer and use it in GitHub Desktop.
array list of allowed html tags to use with wp_kses() function
<?php
function dw_allowed_html_tags() {
$allowed_tags = array(
'a' => array(
'class' => array(),
'href' => array(),
'rel' => array(),
'title' => array(),
),
'abbr' => array(
'title' => array(),
),
'b' => array(),
'blockquote' => array(
'cite' => array(),
),
'cite' => array(
'title' => array(),
),
'code' => array(),
'del' => array(
'datetime' => array(),
'title' => array(),
),
'dd' => array(),
'div' => array(
'class' => array(),
'title' => array(),
'style' => array(),
),
'dl' => array(),
'dt' => array(),
'em' => array(),
'h1' => array(),
'h2' => array(),
'h3' => array(),
'h4' => array(),
'h5' => array(),
'h6' => array(),
'i' => array(),
'img' => array(
'alt' => array(),
'class' => array(),
'height' => array(),
'src' => array(),
'width' => array(),
),
'li' => array(
'class' => array(),
),
'ol' => array(
'class' => array(),
),
'p' => array(
'class' => array(),
),
'q' => array(
'cite' => array(),
'title' => array(),
),
'span' => array(
'class' => array(),
'title' => array(),
'style' => array(),
),
'strike' => array(),
'strong' => array(),
'ul' => array(
'class' => array(),
),
);
return $allowed_tags;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment