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 8 months 2020-11-26T19:10:25-05:00 0 Answers 7 views 0

Leave an answer