Forums
Home / Fixing WordPress / hide admin toolbar in mobile only
(@branhampaul)
1 year, 7 months ago
Kindly, I need help with hiding the admin toolbar in mobile only for administrator – toolbar should show when viewing on PC.
I want the toolbar disabled when I am on mobile only.
(@aatanasov)
You can achieve this by adding the following CSS code to your theme:
@media only screen and (max-width: 768px) { #wpadminbar { display: none; } }
(@imasikur22)
https://wordpress.org/support/topic/mobile-admin-bar-disable/
@aatanasov that code does not work. It just outputs the code verbatim at the top of every page.
I use HFCM plugin for CSS inclusion.
______
@imasikur22 Which of the codes in the linked post should I use?
Okay. It finally worked! This code cited here (https://wordpress.org/support/topic/mobile-admin-bar-disable/) did it.
if(wp_is_mobile()){ add_filter( 'show_admin_bar', '__return_false' ); }
The admin toolbar no longer shows when I am on mobile.
Thanks to you all. Appreciated.