Menu

Disable WordPress Admin Bar on mobiles but enable on desktops for logged in users

Disable the WordPress Admin Bar on mobiles but enable on desktops for logged in users:

<?php
// Disable the admin bar on mobiles but enable on desktops
function cornerstone_show_admin_bar() {
if( wp_is_mobile() || !is_user_logged_in() ) {
return false;
} else {
return true;
}
}
add_action( 'show_admin_bar' , 'cornerstone_show_admin_bar');
?>
view raw functions.php hosted with ❤ by GitHub