• Skip to main content
  • Skip to primary sidebar
  • Business
  • WordPress
  • Security
  • Marketing
  • Publicity
  • Computing
  • Resources
  • Whatevs

Purely Wordpress

Just The Tech, News, and Info We Deem To Post

  • Home
  • About
  • Contact
  • Contribute
You are here: Home / WordPress Functionality / Add or Remove Links From the WordPress Admin Bar

Add or Remove Links From the WordPress Admin Bar

Screenshot of WordPress plugin php and html code

Use This Snippet to Add Links to Admin Toolbar

Add the following code to your WordPress theme’s function.php file, or a functionality plugin. Modify the example for your link.

  • diww where diww is the ID of your menu item.
  • my-blogs where my-blogs is the parent ID of your menu item.
  • Title of the link you want to add where Title of the link you want to add is the title you want to use for your menu item.
  • http://mysitesurl.com/wp-admin.php where http://mysitesurl.com/wp-admin.php is the admin url of your menu item.
/** Use This Snippet to Add Links to Admin Toolbar */

function my_admin_bar_link() {
	global $wp_admin_bar;
	if ( !is_super_admin() || !is_admin_bar_showing() )
		return;
	$wp_admin_bar->add_menu( array(
	'id' => 'diww',
	'parent' => 'my-blogs',
	'title' => __( 'Title of the link you want to add'),
	'href' => admin_url( 'http://mysitesurl.com/wp-admin.php' )
	) );
}
add_action('admin_bar_menu', 'my_admin_bar_link');

Use This Snippet to Remove Links to Admin Toolbar

Add the following code to your WordPress theme’s function.php file, or a functionality plugin.

  • my-blogs where my-blogs is the ID of the menu item you want to remove
  • my-account-with-avatar where my-account-with-avatar is the ID of the menu item you want to remove
/** Use This Snippet to Remove Links to Admin Toolbar */

function remove_admin_bar_links() {
	global $wp_admin_bar;
	$wp_admin_bar->remove_menu('my-blogs');
	$wp_admin_bar->remove_menu('my-account-with-avatar');
}
add_action( 'wp_before_admin_bar_render', 'remove_admin_bar_links' );

by Jack Alltrade on April 19, 2016

Filed Under: WordPress Functionality Tagged With: Admin Menu, Code

Reader Interactions

Share Your Two Cents Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Categories

  • Code Snippets
  • Development
  • File Management
  • Genesis Framework
  • Hosting
  • Legacy
  • Plugins
  • SEO
  • Tech Terms
  • Themes
  • User Experience
  • User Interface
  • WordPress Core
  • WordPress Functionality

© Copyright Jack Alltrade & Associates 2025 · Purely Supplemental™ is a trademark of Jack Alltrade & Associates