Home / Admin / Hide unnecessary roles
Duplicate Snippet

Embed Snippet on Your Site

Hide unnecessary roles

Masque les roles qui ne doivent pas être utilisés dans les filtres utilisateurs

Code Preview
php
<?php
add_filter( 'editable_roles', function( $roles ) {
if (!current_user_can('administrator') && !is_admin()) {
    unset( $roles['administrator'] );
  }
	unset( $roles['editor'] );
	unset( $roles['subscriber'] );
	unset( $roles['revisor'] );
	unset( $roles['docspress_manager'] );
	unset( $roles['author'] );
	unset( $roles['contributor'] );
	
	return $roles;
} );

Comments

Add a Comment