Filter: clarkson_role_class

apply_filters( 'clarkson_role_class', $type, $role ) → {null|string}

Allows the theme to overwrite class that is going to be used to create a role object.
Parameters:
Name Type Description
$type null | string Sanitized class name.
$role WP_Role Sanitized class name.
Since:
  • 1.0.0
Source:
Returns:
Class name of role to be created.
Type
null | string
Example
// load a different class instead of what Clarkson Core calculates.
add_filter( 'clarkson_role_class', function( $type, $role ) {
 if ( $role->name === 'example' ){
     $type = self::OBJECT_CLASS_NAMESPACE . 'custom_role_class';
 }
 return $type;
}, 10, 2 );