Skip to content

Instantly share code, notes, and snippets.

@freezvd
Created April 11, 2015 07:29
Show Gist options
  • Save freezvd/11cb75313ddeb90fbdc5 to your computer and use it in GitHub Desktop.
Save freezvd/11cb75313ddeb90fbdc5 to your computer and use it in GitHub Desktop.
Removing Items from admin bar
<?php
/**
* Remove links/menus from the admin bar
*
* Comment out what you want to keep.
*
* @author Vajrasar Goswami ([email protected])
*
* @see https://codex.wordpress.org/Class_Reference/WP_Admin_Bar
* @see https://codex.wordpress.org/remove_node
*/
function vg_custom_admin_bar() {
global $wp_admin_bar;
$wp_admin_bar->remove_node( 'wp-logo' );
$wp_admin_bar->remove_node( 'site-name' );
$wp_admin_bar->remove_node( 'updates' );
$wp_admin_bar->remove_node( 'comments' );
$wp_admin_bar->remove_node( 'new-content' );
$wp_admin_bar->remove_node( 'edit' );
}
add_action( 'wp_before_admin_bar_render', 'vg_custom_admin_bar' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment