I did a quick research on this and I don’t think you can with a function, as said in the codex.
Note: It is no longer possible to hide the Toolbar when viewing the Administration Screens, but users can disable it on the front-end of the site in their Profile screen.
Disabling in the frontend results in the same as you’ve already done.
I would suggest hiding it with css.
#wpadminbar {
display: none;
}
html {
padding-top: 0; // Move up the page's content by the bar's height
}
Related Posts:
- custom user role wordpress – grant guest access to edit.php without insert/update/delete
- Setting $_SERVER[‘HTTPS’]=’on’ prevents access to wp-admin
- Remove update nags for non-admins [duplicate]
- Allow Editors to edit pending posts but not draft ones
- wp_insert_user role not working
- How to target with css, admin elements according to user role level?
- Admin Bar (Toolbar) not showing on custom PHP file that loads WordPress
- Editor role cannot save custom theme options
- Allow authors to post only in categories they create in WordPress
- wordpress separate registration for different roles
- How to Add a Link to the Drop-Down User Menu in the Admin Bar?
- woocommerce and is_user_logged_in() if not redirect to homepage
- Display user role Name – not slug
- Add user settings to specific roles
- How to give new users two specific user role options upon WordPress user registration
- Correct folder permissions?
- Hiding div based on user role
- Cannot execute php files in wp-content
- Do not execute If User is login as Administrator or any Specific Role
- WordPress installation permission errors
- Add post with approval by the admin
- How to keep the capability of users and disable Gutenberg editor in WordPress?
- How to allow download url redirection only if user logged in WordPress site?
- Shortcode for Listing Users from Meta Value?
- Array to string conversion error in PHP 7.2 when returning user role as class
- Noindex subscriber author page
- Query for user roles
- call adminbar greeting in other place
- Plugin can’t write to database even though permissions appear correct?
- How can I call a specific file (via php) by referencing the logged-in username?
- Plugin: Front-end Editor – User role specific editable content?
- Execute PHP code only with specific user role
- Edit and delete permissions pages and posts
- How to Add a cutsom slug to my custom author role
- Execute function only for specific user roles
- Allow a user or role to view drafts and previews, but not other admin privileges?
- how to create a user rule that can only manage support tickets?
- Hide payment method based on user role AND minimum cart value
- Edit a function to take different actions based on user role
- Get WordPress username to customize url
- Used a code to revoke some dashboard menus for my contributors but for some reason it’s revoked me access to the editor [closed]
- How to give custom roles the capability to edit one Menu instead of every Menu
- Access to “My Site” is missing from the admin bar
- WordPress and WordPress-test-lib not getting added to tmp folder
- Add another role to a user when they click a button?
- Obtain wordpress user role
- missing admin bar and widget in a template
- How to properly create multiple conditions to redirect users roles to different pages
- Echo Option Value Based On WordPress User Role
- Load admin bar without wp_head or wp_footer [duplicate]
- Role exception for a settings sub menu
- What is the best practice for restricting a section to logged in users?
- Allow BBPress participant role to trash topics
- Custom user roles doesn’t apply changes
- Plugin PHP write permissions
- how to use php in custom toolbar form
- 403 (Forbidden) delete file image in themer folder
- Include administrator in author list
- How to connect database table to each registered wordpress user.
- Permission functions within wordpress
- Get author meta of all writers
- Switch-Case and user_role
- Masking external links with internal link for member-only
- Forbid certain users to access a specific page
- How to lock users account until approvation
- WordPress directories not writable after PHP version upgrade
- How to create a User Role and give permission to only use Web Stories plugin?
- How to create custom user role without plugin?
- Custom Admin Menu Report for Specific User ID
- How to add custom user role into wordpress
- WordPress Create New Role Just to Manage Users?
- Hide ID for WordPress User Role Subscriber
- Sort on two variables
- Unable to get Post Category Name and URL
- Custom Thumbnails [closed]
- How to display recently modified posts on recent post widget in wordpress
- Search results template listing all posts
- Else if Statement for Advanced Custom Fields [closed]
- Woocommerce custom field on emails outputs ‘Array’
- index.php navigation
- My function echos only “array”
- How do I correct this filecount?
- Front page not loading after updating PHP version (ec2)
- Form direction to .php on localhost
- Notify admin (by email) if post added with specific tag
- Stripe button is not working in a template page
- Explode Content within specific HTML element
- Using get_theme_mod with checkbox to display content
- Fatal Error cannot log into wordpress and website disappeared
- Private messaging – Getting and displaying the avatar/url of a message recipient
- I’m writing my first plugin and my echo output is showing up on every page of my wordpress installation
- How can I move the posted-on date above the post and below the entry-header?
- Beyond widget side menu editing, with the php page, custom template
- Updating custom user meta
- Rotating Header Images
- How can I display a query in a page?
- changing static link to relative link
- WordPress while loop with aphabetic counting like one, two, three
- How to list categories by page id in wordpress
- Font-Family does not looks like how it should be [closed]