wp_roles() WordPress Function

The wp_roles() function is used to retrieve a list of roles defined on the site. This function returns an array of role objects, each of which contains a role ID and a role name.

wp_roles() #

Retrieves the global WP_Roles instance and instantiates it if necessary.


Return

(WP_Roles) WP_Roles global instance if not already instantiated.


Top ↑

Source

File: wp-includes/capabilities.php

function wp_roles() {
	global $wp_roles;

	if ( ! isset( $wp_roles ) ) {
		$wp_roles = new WP_Roles();
	}
	return $wp_roles;
}


Top ↑

Changelog

Changelog
VersionDescription
4.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.