Sometimes you may want to hide the WordPress admin bars from certain pages. For example, the admin bar could interfere with the design. This is especially true if pages open in a lightbox. It is easy to hide the admin bar from certain pages using a filter in WordPress.
WordPress has a filter called show_admin_bar. If true is returned, his filter will show an admin bar. However, it will not show the admin bar if a false is returned. The $bool value is passed to WordPress, which will decide whether the admin bar should appear or not. The following code can be added to your theme’s functions.php.
If ( is_page_template() ‘page-popup.php’) )?
The code checks to see if page-popup.php is used. This is the theme file I used to show pages opening in a lightbox. We return false to suppress the admin bar from being displayed on pages that use this template. If it is not, we return false to suppress the admin bar. The template conditional is only one example. Other WordPress conditionals could be used to disable the admin bar for many other situations.
When your user logs into your website, they will see the Admin Bar at the top of the site. It’s essentially a toolbar that provides quick access to dashboard features on the front end. It is not always useful to have it visible on the frontend for users who are logged in. You can disable WordPress Admin Bar and hide the WordPress admin bar for all users, except admin. The RegistrationMagic plugin is all you need.
How can I hide the admin bar from WordPress?
People prefer to see the Admin Bar at the top of their pages when logging in from the frontend. However, it is better to have the toolbar off in some cases. You may need to display a full-screen site page while logged in to the site. It’s best to hide the admin bar as it contains all of the editing tools you would normally find on the dashboard.
The admin bar is also more useful for the author, editor, or admin. These WordPress user roles play an active role in site development. They need access to the admin bar, which contains shortcuts to different screens on the dashboard.
You can see the admin bar on both the frontend and backend of your website. Below is an illustration of the admin bar located at the top right-hand corner of the dashboard screen. It has been marked in red to make it easier to see.
Navigating to the “General Settings”
Now, let’s learn how to hide WordPress admin bars from your website’s front page. Install the RegistrationMagic plugin first. Then, we’ll move ahead.
Click on the link “Global Settings” from the plugin menu. Global Settings contains all the necessary settings for this WordPress registration page plugin. This covers all aspects of the plugin, from user accounts to WordPress forms security to external integrations.
Next, go to the “Global Settings” screen and click on the “General Settings” option. This section allows you to access all of your forms from one location. This saves time. You don’t need to adjust each form individually. This screen can also edit WordPress forms layout, file types allowed for upload, and other settings.
Hide WordPress Admin Bar For All Users Other Than Admin
Scroll down to the “General Settings” screen, and you’ll find the “Hide WordPress Toolbar” setting.
This is the fifth setting. To deactivate the checkbox “Hide WordPress Toolbar”, click here. This setting hides the admin bar or toolbar from the frontend and can be disabled. All logged-in users will be able to see the admin bar when they visit your site via the frontend. However, the admin bar will still be visible to site administrators to access it from the frontend.
To save your changes, don’t forget to click “Save.”
What is the purpose of the Admin Bar being cached?
Your Admin Bar will be cached if your integration meets the following criteria.
- Full Site Integration Without WAF
- After a page purge, an admin user logs in and sends the first request (after logging in) to CDN.
- Specify CDN time limit for StackPath CDN caching
These conditions will allow your Origin to respond to the CDN’s request to cache content. The HTML file will reference the Admin Bar asset, and the CDN will override any no-cache header normally attached by your Origin to this page. The CDN will request the Admin Bar asset directly from your Origin and then place it in the cache. The cached request will be sent to the administrator logged in for any user who requests the same page again.
Avoid the Caching of the Administration Bar
You have two options to stop the caching of your admin bar.
- This modifies WordPress settings so that the admin bar is not used on public pages.
- The second will change your CDN settings to respect the correct Cache-Control headers from your Origin. Your Admin Bar will still function as before.
It is very easy to disable WordPress admin bars for all users, except the admin using RegistrationMagic.
The wordPress admin bar is hidden on all professional websites, whether online shops, blogs, or community sites. Only site builders can use the admin bar. It is not something your users will see when they visit your website. It also makes your site look unorganized and takes up space. Users love the neatness of clean and spacious sites. It is better to hide your admin bar from non-admins. This will make your site appear smarter.
The RegistrationMagic plugin takes care of all aspects of site appearance. It allows you to create a smart WordPress registration web page and an intelligent Contact Form for your site.
If you’re yet to start your WordPress site and looking for the best WordPress hosting, AccuWebHosting is the one-stop destination.
(Visited 11 times, 3 visits today)