Action hook 'wp_roles_init'

in WP Core File wp-includes/class-wp-roles.php at line 303

View Source

wp_roles_init

Action Hook
Description
Fires after the roles have been initialized, allowing plugins to add their own roles.

Hook Information

File Location wp-includes/class-wp-roles.php View on GitHub
Hook Type Action
Line Number 303

Hook Parameters

Type Name Description
WP_Roles $wp_roles A reference to the WP_Roles object.

Usage Examples

Basic Usage
<?php
// Hook into wp_roles_init
add_action('wp_roles_init', 'my_custom_function', 10, 1);

function my_custom_function($wp_roles) {
    // Your custom code here
}

Source Code Context

wp-includes/class-wp-roles.php:303 - How this hook is used in WordPress core
<?php
 298  		 *
 299  		 * @since 4.7.0
 300  		 *
 301  		 * @param WP_Roles $wp_roles A reference to the WP_Roles object.
 302  		 */
 303  		do_action( 'wp_roles_init', $this );
 304  	}
 305  
 306  	/**
 307  	 * Sets the site to operate on. Defaults to the current site.
 308  	 *

PHP Documentation

<?php
/**
		 * Fires after the roles have been initialized, allowing plugins to add their own roles.
		 *
		 * @since 4.7.0
		 *
		 * @param WP_Roles $wp_roles A reference to the WP_Roles object.
		 */
Quick Info
  • Hook Type: Action
  • Parameters: 1
  • File: wp-includes/class-wp-roles.php
Related Hooks

Related hooks will be displayed here in future updates.