$string = $_POST['data']['container']['box'];
$allowed = array(
'div' => array
(
"style" => array(),
"class" => array(),
"entrance" => array()
),
'p' => array
(
"class" => array(),
"style" => array(),
"id" => array()
),
'a' => array
(
"href" => array(),
"class" => array()
),
'h1' => array
(
"style" => array(),
"id" => array()
),
'hr' => array
(
"class" => array(),
"style" => array()
)
);
$sanitizedBox = wp_kses($string,$allowed);
这是我的wp_kses代码。除了元素div
没有收到style
属性外,输出的所有内容都很好。有人能告诉我代码有什么问题吗?