Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment