我建议创建Custom User Role, 使用add_role()
功能,例如“站点管理员”或“子管理员”(或任何您想调用的功能)。那么,你可以assign specific user capabilities 从而为用户提供您想要的功能,而不是您不想要的功能。
例如:
<?php
add_role(
// Role slug
\'sub-admin\',
// Role display name
\'Sub-Admin\',
// Capabilities
array(
activate_plugins,
add_users,
create_users,
delete_others_posts,
delete_pages,
delete_plugins,
delete_posts,
delete_private_pages,
delete_private_posts,
delete_published_pages,
delete_published_posts,
delete_users,
edit_dashboard,
edit_files,
edit_others_posts,
edit_pages,
edit_posts,
edit_private_pages,
edit_private_posts,
edit_published_pages,
edit_published_posts,
edit_theme_options,
export,
import,
list_users,
manage_categories,
manage_links,
manage_options,
moderate_comments,
publish_pages,
publish_posts,
read_private_pages,
read_private_posts,
read,
remove_users,
switch_themes,
unfiltered_upload,
upload_files
)
);
?>
(这些是默认的“管理员”功能,删除了与编辑他人页面和提升用户相关的上限。)
可用的插件有多个可用的插件,可提供用于创建和修改用户角色的UI,包括: