Why is wp_kses not keeping style attributes as expected?


I want to keep the style attribute. $str is just an example, here’s my code:

$allowed_html = array(
     'div' => array(
         'title' => array(),
         'class' => array(),
         'style' => array()

$str = '<div title='Click to continue' style='display:table'>This is a button</div>';
wp_kses($str, $allowed_html );

$str will actually receive a bunch of html tags and attributes from a post. Then from there i want to strip out all tags and attributes leaving out only divs tags and style and title attributes

Thank you, MMK.

MMK 2 months 0 Answers 7 views 0

Leave an answer