Disable Wordpress Admin Bar and Dashboard for users other than admin

Hello, I followed this to get rid of the toolbar for a subscriber but it still shows. Here’s the code I used:

add_action(‘after_setup_theme’, ‘remove_admin_bar’);

function remove_admin_bar() {
if (!current_user_can(‘administrator’) && !is_admin()) {
show_admin_bar(false);
}
}

Also how do I get rid of the dashboard for all other users? Basically, I don’t want a logged in user(non-admin) to have any access of any kind to the backend.

Thanks!

I cleared the cache and now the toolbar is gone but there is plus sign and when I click it it opens a blank white thing that covers the menu. How do I get rid of that?

So with that user I went to sugarfreegallery.com/wp-admin and it goes to dashboard. How would I deny access? Redirect to homepage, error page? Help please~!

Thanks again!

Nevermind the wp-admin dashboard question! I guess that needed the cache to be cleared also. Oops :blush:

The plus sign thing remains though. THANK YOU.

Hey There,

We are just glad that you have figured it out a way to correct the said issue. Thanks for letting us know!

The plus sign is not part of the admin bar. It is the header widget area. You can disable it by going to the theme Options, X > Launch > Options > Header > WidgetBar and select “None”.

Best Regards.

Cool. Thanks :grin:

You’re welcome! :slight_smile:

I didnt wanted to open new topic for this subject, but I tried this method, installed child theme but it didnt work, when I login in as subscriber I see admin panel

Am I doing something wrong? I pasted the code underAdditional functions

Hi @b00mdesigner,

Thanks for writing around! You may want to try this http://www.wpbeginner.com/wp-tutorials/how-to-disable-wordpress-admin-bar-for-all-users-except-administrators/

Hope this helps!

nope, same as before, I try to login as subscriber and still I see admin bar

cleared cache, tried on another pc that didnt visit site before, all the same

How do I make next response private so I can give you login details?

Hi There,

You need to open a new thread explain your situation briefly and provide your credentials in a secure note.

Thank you