Remove WordPress SEO Menu from Toolbar (Admin Bar)

»»»Remove WordPress SEO Menu from Toolbar (Admin Bar)
After installing and activating WordPress SEO by Yoast, the plugin automatically adds a menu item called “SEO” to the toolbar (also admin bar) of WordPress, visible in /wp-admin backend administration pages. The SEO link provides quick access to keyword research, SEO settings and etc.

But the SEO link in the WordPress toolbar is not always useful for everyone, and you may want to hide the SEO element from other users of your WordPress powered site.

WordPress SEO Admin Toolbar Menu Link

WordPress SEO plugin does not provide any option or setting to hide or unhide the SEO link on the WordPress admin toolbar. But we can always remove the undesired WordPress SEO element on the admin bar through filters and hooks.

Add the following code snippet into your active theme to remove the WordPress SEO menu entry on the admin toolbar:

add_action( 'wp_before_admin_bar_render', 'tj_admin_bar_render' );
function tj_admin_bar_render() {
	global $wp_admin_bar;
	$wp_admin_bar->remove_menu('wpseo-menu');
}
Tip
You can use various WordPress functions such as wp_get_current_user() and current_user_can() which returns roles and capabilities to restrict the hiding of WordPress SEO menu element to certain group of users. For example, we can hide the WordPress SEO to all users who do not have permissions to manage options with the following script:

add_action( 'wp_before_admin_bar_render', 'tj_admin_bar_render' );
function tj_admin_bar_render() {
	if (!( current_user_can( 'manage_options' ) )) {
		global $wp_admin_bar;
		$wp_admin_bar->remove_menu('wpseo-menu');
	}
}

By |2016-12-09T08:38:55+00:00December 9th, 2016|Categories: Web Publishing|Tags: , , |0 Comments

About the Author:

LK is a technology writer for Tech Journey with background of system and network administrator. He has be documenting his experiences in digital and technology world for over 15 years. Connect with LK through Tech Journey on Facebook, Twitter or Google+.

STAY IN TOUCH

close-link