How to hide user role from user role dropdown in WordPress

<?php add_action( 'editable_roles' , 'hide_editable_user_roles' ); function hide_editable_user_roles($roles) { unset( $roles['subscriber'] ); unset( $roles['author'] ); unset( $roles['contributor'] ); unset( $roles['editor'] ); unset( $roles['wpseo_editor'] ); unset( $roles['wpseo_manager'] ); return $roles; }…

Continue Reading How to hide user role from user role dropdown in WordPress

Hide Administrator from Filter user list using css in WordPress

<?php add_action('admin_init','hide_admin_filter_user_list'); function hide_admin_filter_user_list() { $user = wp_get_current_user(); if ( in_array( 'agent_admin', (array) $user->roles ) ) { ?> <style> ul.subsubsub li.administrator{ display:none; } </style> <?php } } ?>

Continue Reading Hide Administrator from Filter user list using css in WordPress

Hide a user from user list table in WordPress

<?php add_action('pre_user_query','hide_admin_user_list_detail'); function hide_admin_user_list_detail($user_search) { global $current_user; $username = $current_user->user_login; $user = wp_get_current_user(); if(in_array( 'agent_admin', (array) $user->roles )) { global $wpdb; //$user_search->query_where = str_replace('WHERE 1=1', "WHERE 1=1 AND {$wpdb->users}.user_login !=…

Continue Reading Hide a user from user list table in WordPress

A specific user can not create user of a specific role in WordPress

<?php add_action( 'editable_roles' , 'hide_administrator_user_roles' ); function hide_administrator_user_roles($roles) { $user = wp_get_current_user(); if ( in_array( 'agent_admin', (array) $user->roles ) ) { unset( $roles['administrator'] ); } return $roles; }   ?>

Continue Reading A specific user can not create user of a specific role in WordPress