问题描述
有没有通过挂钩重命名用户角色名称,而不是使用插件?
Edit
例如,administrator
»owner
最佳解决方案
function change_role_name() {
global $wp_roles;
if ( ! isset( $wp_roles ) )
$wp_roles = new WP_Roles();
//You can list all currently available roles like this...
//$roles = $wp_roles->get_names();
//print_r($roles);
//You can replace "administrator" with any other role "editor", "author", "contributor" or "subscriber"...
$wp_roles->roles['administrator']['name'] = 'Owner';
$wp_roles->role_names['administrator'] = 'Owner';
}
add_action('init', 'change_role_name');
http://www.garyc40.com/2010/04/ultimate-guide-to-roles-and-capabilities/
参考文献
注:本文内容整合自 google/baidu/bing 翻译的英文资料结果。如果您对结果不满意,可以加入我们改善翻译效果:gxnotes#qq.com(#替换为 @) 。