translate_level_to_role

Advertisement

Summery Summery

Translate user level to user role name.

Syntax Syntax

translate_level_to_role( int $level )

Parameters Parameters

$level

(Required) User level.

Return Return

(string) User role name.

Source Source

File: wp-admin/includes/upgrade.php

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';
	}
}

Advertisement

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.

Advertisement

Leave a Reply