Skip to content

Instantly share code, notes, and snippets.

@lightningspirit
Created February 17, 2022 21:46
Show Gist options
  • Save lightningspirit/4ee2e8bb0caac832fa5271e598e8ac08 to your computer and use it in GitHub Desktop.
Save lightningspirit/4ee2e8bb0caac832fa5271e598e8ac08 to your computer and use it in GitHub Desktop.
Disable WordPress Admin Bar MU-Plugin

Disable WordPress Admin Bar MU-Plugin

Disable the admin bar for all users automatically.

Usage

  1. Download or copy the disable-admin-bar.php file
  2. Place it under wp-content/mu-plugins
  3. Done
<?php
/**
* Plugin Name: Disable Admin Bar
* Plugin URI: https://gist.github.com/lightningspirit/4ee2e8bb0caac832fa5271e598e8ac08
* Author: Move Your Digital, Inc.
* Author URI: https://moveyourdigital.com
* Version: 0.1.0
*
* @package Disable_Admin_Bar
*/
/*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**#@+
* Disable WordPress Admin Bar for all users
*/
add_filter( 'show_admin_bar', '__return_false' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment