在下面发布html内容时,可以在admin上发布,但是其他用户则剥离所有HTML标记
$my_post = array('post_title' => $title,
'post_content' => $content,
'post_category' => array(520),
'post_status' => 'Publish',
'post_name' => $url
);
$result = wp_insert_post( $my_post );
有没有一种方法允许任何用户发布HTML标签。
答案 0 :(得分:0)
我发现,如果我在代码之前使用它,它将起作用。
$sub_role = get_role( 'subscriber' );
$sub_role->add_cap( 'unfiltered_html', true );