WordPress SEO by Yoast
Remove SEO menu from admin bar (3 posts)

  1. keap
    Posted 4 years ago #

    I am trying to remove the SEO menu from the admin bar for WordPress 3.1. My level of experience in wordpress and php is moderate. Is this configurable? Is there a workaround? Truly I would like to find the code that adds the menu item or where that method is called. From there I should be able to hook it for administrators and editors only.


  2. DannyB
    Posted 4 years ago #

    Firstly, here is a good snippet for adding and removing elements of the admin bar. http://wp-snippets.com/addremove-wp-admin-bar-links/

    The key is finding the id used. Looking at the plugin it appears to be wpseo-menu

    If you add the following to you functions.php it should remove it

    function mytheme_admin_bar_render() {
    	global $wp_admin_bar;
    // and we hook our function via
    add_action( 'wp_before_admin_bar_render', 'mytheme_admin_bar_render' );

    If you want it role based. For example, you want it to show for Admins but not editors you could use a conditional to show only for certain capabilities.

    For example,

    if(! current_user_can( 'manage_options' ) ) {
  3. Maggew Dot Com
    Posted 3 years ago #

    @keap - Reduce code where you can.

    Dive into "./wordpress-seo/inc/wpseo-non-ajax-functions.php" then navigate to line 100. Just start shredding into the code.

    Have fun with your adventure.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic