您好我想知道是否有人可以帮助我。我想为woocommerce商店经理角色增加上限。我发现了此功能,但无法正常工作。
function add_capability() {
// gets the author role
$role = get_role( 'shop_manager' );
// This only works, because it accesses the class instance.
$role->add_cap( 'add_new_user' );
}
add_action( 'admin_init', 'add_capability');
任何人都知道一种解决方案,我将非常感激。
根据当前功能列表,没有称为的功能add_new_user
。请参阅以下链接:http : //codex.wordpress.org/Roles_and_Capabilities#Capabilities。
正确添加create_users
的功能是,添加功能后,该选项将显示在配置文件->添加新用户下
function add_capability() {
// gets the author role
$role = get_role( 'shop_manager' );
// This only works, because it accesses the class instance.
$role->add_cap( 'create_users' );
}
add_action( 'admin_init', 'add_capability');
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句