Skip to content

Instantly share code, notes, and snippets.

@alana-mullen
Last active December 18, 2015 01:18
Show Gist options
  • Save alana-mullen/5702265 to your computer and use it in GitHub Desktop.
Save alana-mullen/5702265 to your computer and use it in GitHub Desktop.
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