Eine neue User-Rolle erstellen

Veröffentlicht von

Hier ein Code-Beispiel, wie man eine neu User-Rolle erstellt, wenn man ein Plugin aktiviert.

function add_roles_on_plugin_activation() {
       add_role( 'custom_role', 'Custom Subscriber', array( 'read' => true, 'level_0' => true ) );
}

register_activation_hook( __FILE__, 'add_roles_on_plugin_activation' );Code-Sprache: PHP (php)