对于默认用户类型(管理员、编辑器等),保存时不会从帖子中删除样式标记。对于自定义用户类型,将删除样式标记。
我在函数中应用了过滤器。php文件,以防止剥离,但作为自定义用户类型登录时会忽略该文件。我还直接编辑了wp includes文件夹中的TinyMCE,即使这样也会被忽略。
下面是如何在我的插件中注册用户类型;
function add_roles_on_plugin_activation_tester() {
add_role( \'tester\', \' Tester\', array(
\'delete_others_pages\' => true,
\'delete_others_posts\' => true,
\'delete_pages\' => true,
\'delete_posts\' => true,
\'delete_private_pages\' => true,
\'delete_private_posts\' => true,
\'delete_published_pages\' => true,
\'delete_published_posts\' => true,
\'edit_others_pages\' => true,
\'edit_others_posts\' => true,
\'edit_pages\' => true,
\'edit_posts\' => true,
\'edit_private_pages\' => true,
\'edit_private_posts\' => true,
\'edit_published_pages\' => true,
\'edit_published_posts\' => true,
\'manage_categories\' => true,
\'manage_links\' => true,
\'moderate_comments\' => false,
\'publish_pages\' => true,
\'publish_posts\' => true,
\'read\' => true,
\'read_private_pages\' => true,
\'read_private_posts\' => true,
\'unfiltered_html \' => true,
\'upload_files\' => true,
\'level_1\' => true
) );
}
register_activation_hook( __FILE__,
\'add_roles_on_plugin_activation_tester\' );
这发生在标准帖子类型和使用ACF版本的自定义帖子类型上。5.7.10自定义字段。
WordPress版本。4.9.9