0
votes

How I can hide WordPress admin panel options for all except one user. I want to hide some setting options and theme options for all users except me (username: jacob).

4

4 Answers

1
votes

This code will hide admin bar for all users:

show_admin_bar( false );

And this one will prevent admin bar from being hidden:

show_admin_bar( false );

So you need to use code for the condition if the username is jacob then show the admin bar and hide it for all the others. So here is the complete code.

global $current_user;
get_currentuserinfo();
if ( is_user_logged_in() ) { 
if($current_user->user_login == 'jacob') { 
show_admin_bar( true );
} else { 
show_admin_bar( false ); 
 } } else { 
   show_admin_bar( false );
}

You can use this code inside your theme's functions.php or you can also create separate plugin for this.

0
votes

Admin Bar Disabler plug-in can hide admin panel for users with roles. I expect you are administrator and rest of users are not (since they shouldn't see the panel), so you can let show Wordpress panel for admin role only. ;)

https://wordpress.org/plugins/admin-bar-disabler/

0
votes

If you have users that are logging in, you can re-direct around the Admin - check perms..

Better yet, send them around it!!

Have a look here - https://wordpress.org/plugins/peters-login-redirect/

I use this on our church website and works great!

Thanks!

0
votes

Add below code into your theme functions.php

global $current_user; get_currentuserinfo(); if ( is_user_logged_in() ) { 
if($current_user->user_login == 'jacob') { 
    show_admin_bar( true );
} else { 
    show_admin_bar( false ); 
} } else {  }

Hope this will help you