hide admin toolbar in mobile only

You can achieve this by adding the following CSS code to your theme:


@media only screen and (max-width: 768px) {
	#wpadminbar { display: none; }
}

@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://projectdmc.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.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Your Advertisement Here