WordPress开发者和主题制作者的搜索引擎



translate_level_to_role ›

Since2.0.0
已弃用n/a
translate_level_to_role ( $level )
参数:
  • (int) $level User level.
    Required: Yes
返回:
  • (string) User role name.
定义在:
文档:

Translate user level to user role name.



源码

function translate_level_to_role( $level ) {
	switch ( $level ) {
		case 10:
		case 9:
		case 8:
			return 'administrator';
		case 7:
		case 6:
		case 5:
			return 'editor';
		case 4:
		case 3:
		case 2:
			return 'author';
		case 1:
			return 'contributor';
		case 0:
		default:
			return 'subscriber';
	}
}