Skip to content

Instantly share code, notes, and snippets.

@neoswf
Last active August 1, 2023 12:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neoswf/e4618d93de2b912ee0bf6afdadd0ad4a to your computer and use it in GitHub Desktop.
Save neoswf/e4618d93de2b912ee0bf6afdadd0ad4a to your computer and use it in GitHub Desktop.

Disable WordPress.com admin Toolbar, using a micro plugin

Please avoid instaling bloated plugins. No need for Code Snippets plugins, when you can create this micro plugin by yourself, and install it on your site, and always enabling and disabling the plugin, as much you would wish for!

How to use this plugin?

  1. Do not install Code Snippets on your site! Its expensive and a waste of time, when you can create your own "code snippets"!
  2. Create a folder inside your plugins folder. Name it Disable Jetpack's Admin-bar.
  3. Copy into it the file inside this gist.
  4. Upload the folder to your site's plugins folder.
  5. Enter your admin panel and activate the plugin.

Well done! You got your old pall, self hosted admin bar, on WP.COM!

P.S. If you wish to remove items from your admin-bar, please follow this link: https://digwp.com/2016/06/remove-toolbar-items/

<?php
/**
* Plugin Name: Disable Jetpack's Admin-bar
* Plugin URI: https://saboresdeisrael.com.br
* Description: Bring back self hosted admin-bar, and all its buttons
* Version: 1.0.0
* Author: Shlomi Asaf
*/
// bring back selfhosted adminbar
function disable_wpcomtoolbar ( $modules ) {
if ( isset( $modules['masterbar'] ) ) {
unset( $modules['masterbar'] );
}
return $modules;
}
add_filter( 'jetpack_get_available_modules', 'disable_wpcomtoolbar' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment