Support » Plugin: Yoast SEO » [Plugin: WordPress SEO by Yoast] Remove SEO menu from admin bar

  • 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.

    http://wordpress.org/extend/plugins/wordpress-seo/

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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

    <?php
    function mytheme_admin_bar_render() {
    	global $wp_admin_bar;
    	$wp_admin_bar->remove_menu('wpseo-menu');
    }
    // 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' ) ) {
    $wp_admin_bar->remove_menu('wpseo-menu');
    }

    @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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: WordPress SEO by Yoast] Remove SEO menu from admin bar’ is closed to new replies.