WordPress.org

Ready to get started?Download WordPress

Forums

Dashboard Tweaks
[resolved] WP Submenu Drop Down not removed (11 posts)

  1. WebEndev
    Member
    Posted 2 years ago #

    This piece of code:

    function sl_dashboard_tweaks_render() {
    	global $wp_admin_bar;
    	$wp_admin_bar->add_menu( array(
    		'id'    => 'wp-logo',
    		'title' => '<span class="sl-dashboard-logo"></span>',
    		'href'  => is_admin() ? home_url( '/' ) : admin_url(),
    		'meta'  => array(
    			'title' => __('Visit the Frontend of your website'),
    		),
    	) );
    	$wp_admin_bar->remove_menu('about');
    	$wp_admin_bar->remove_menu('wporg');
    	$wp_admin_bar->remove_menu('documentation');
    	$wp_admin_bar->remove_menu('support-forums');
    	$wp_admin_bar->remove_menu('feedback');
    	$wp_admin_bar->remove_menu('view-site');
    }
    add_action( 'wp_before_admin_bar_render', 'sl_dashboard_tweaks_render' );

    removes each of the submenu items, but the drop down is still there. And the warning "Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\test3_3\wp-includes\class-wp-admin-bar.php on line 245" is in the drop down.

    Thanks

    http://wordpress.org/extend/plugins/dashboard-tweaks/

  2. olyma
    Member
    Posted 2 years ago #

    I've got a plugin, too, with this problem in 3.3 RC-1 and I haven't completely fixed the issue yet, but according to the Dev Chat IRC logs:

    * Introduce a get_node() method for plugins.
    * Deprecate $wp_admin_bar->menu. Plugins will need to use get_node(), remove_node(), add_node() to make modifications. This finalizes a backwards incompatible change made earlier in the cycle.
    * Allow add_node() to take a node object (which could come from get_node(), then be modified).
    * Ensure that our underlying storage (the nodes property) is private to core. Introduce _set_node, _unset_node, _get_nodes, get_nodes as the only ways to interface with this.

    Some sort of standards for these seem to be found in the /wp-includes/class-wp-admin-bar.php.

  3. Piet
    Member
    Plugin Author

    Posted 2 years ago #

    Apologies for my late response.

    You are right that it doesn't remove the submenu, but hides it instead; sorry for the bad choice of words, I will fix that soon.

    I cannot however reproduce the warning you are receiving.

    I will look into this and if you have more information on this, it would be a great help.

  4. Lee Rickler
    Member
    Posted 2 years ago #

    I get the above error on a live site but not on a local set-up - both using 3.3 rc1.

  5. WebEndev
    Member
    Posted 2 years ago #

    FYI - The plugin now works with 3.3 RC2

    Apparently there were some corrections done in RC2 that resolved the issue.

  6. Lee Rickler
    Member
    Posted 2 years ago #

    I does look like it's sorted now.
    At least, it's working on my live and local test sites.

  7. Piet
    Member
    Plugin Author

    Posted 2 years ago #

    Great news, thanks for checking that @Bruce and @Lee! Been swamped lately, hence my later than usual responses.

    Other responses on the same subject on:
    - Google+

    - WP TIPS

  8. 10sexyapples
    Member
    Posted 2 years ago #

    add_action( 'admin_bar_menu', 'remove_wp_logo_links', 25 );
    function remove_wp_logo_links( $wp_admin_bar ) {
        $wp_admin_bar->remove_node('wp-logo');
    }

    This worked for me ;-)

  9. Piet
    Member
    Plugin Author

    Posted 2 years ago #

    @sexyapples thanks for your alternative solution. However this topic has been marked as resolved for a month orso or do you still experience difficulties with the plugin?

  10. 10sexyapples
    Member
    Posted 2 years ago #

    Oh my goodness Piet ... I was just feverishly surfing around the other day and happened upon here and saw the questions ... the issue was something I had just dealt with so I thought I'd be helpful and quickly post ... didn't even realize I wasn't on the general forums ... my apologies

  11. Piet
    Member
    Plugin Author

    Posted 2 years ago #

    hahaha, no worries and thanks for the alternative then :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic