Admin Bar

#61864
  • Resolved Michael Martin
    Rank Math free

    Hi guys, is there a snippet to turn off RankMath from the admin bar in WP dashboard? I never use it from there and it’s taking up space unnecessarily as a result. Thanks for your help.

    Michael.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Alberto
    Rank Math business

    Hello Michael,

    Thank you for contacting Rank Math today.

    You could try to use this filter:

    /**
     * Remove items from the Rank Math admin bar node.
     *
     * @param array $items Array of nodes for Rank Math menu.
     */
    add_filter( 'rank_math/admin_bar/items', function( $items ) {
     return null;
    });

    Looking forward to helping you. Thank you.

    ​​​​​​

    Hi Alberto,

    Thanks for your help. I actually got it working myself earlier. I’m including the code in case it is useful for anyone else 🙂

    function wps_admin_bar() {
        global $wp_admin_bar;
    	
        $wp_admin_bar->remove_node('rank-math');
    	$wp_admin_bar->remove_node('ecwid-main');
    	$wp_admin_bar->remove_node('comments');
    	$wp_admin_bar->remove_node('new-content');
        $wp_admin_bar->remove_node('edit');
        $wp_admin_bar->remove_node('customize');
    	
    }
    add_action( 'wp_before_admin_bar_render', 'wps_admin_bar', 999 );
    Alberto
    Rank Math business

    Hello,

    Thank you for sharing it, I am pretty sure other users will find it really useful.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this ticket.