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
- Dynamically loaded Theme components based on Customizer Settings values : changes not appearing in Customizer preview – (Workaround found)
- How can I default to all WordPress roles when parameter is not included in shortcode?
- Export WordPress Table to CSV from page
- Trying to regain access to a wordpress based website
- woocommerce registration form with klaviyo(don’t work with current user)
- Customizer – Prefix Class Extension
- Create onClick Event to Re-load a Widget
- Search Query: how to construct a search string from two select elements?
- Is it possible to retrieve all posts with a certain value for metadata?
- variable value disappears in a second loop
- Add meta tags to a custom header
- Ajax filter button display all posts
- Check If Post Was Published More Than 6 Months Ago Using get_the_date
- How to prevent a function from running based on host (ie web vs local)?
- Delete images from media library when user deletes an image from ACF Gallery
- Array data not saving to specified sections. How to make seting independantly?
- How to get woocommerce orders with get_posts method in a shortcode
- Change category thumbnail size
- problem in using wpdb->prepare and a string placeholder
- Custom content using in_category
- Need help with PHP functions
- When using shortcode, content stops generating after the_content
- How do you detect if a specific word is at the end of a the_title()
- Combining fancybox with multiple thumbnail plugin
- How to display thumbnail if post is assigned one otherwise not
- How to check “From Email” via WordPress before an email is sent
- Remove Unused Menu Locations
- login redirect based on user role not work as expected
- redirect user from login page if is logged
- How to set variable to specific field when querying