wp_roles

Retrieves the global WP_Roles instance and instantiates it if necessary.

Description

(WP_Roles) wp_roles(); 

Returns (WP_Roles)

WP_Roles global instance if not already instantiated.


Usage

  1. if ( !function_exists( 'wp_roles' ) ) { 
  2. require_once ABSPATH . WPINC . '/capabilities.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wp_roles(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/capabilities.php  
  1. functionwp_roles) { 
  2. global $wp_roles; 
  3.  
  4. if ( ! isset( $wp_roles ) ) { 
  5. $wp_roles = new WP_Roles(); 
  6. return $wp_roles;