Hide from specific role the top admin bar new button

The item you want to remove is a “node”. When you look at the generated HTML of the WP toolbar, the ID of the list item (<li>) contains the node.

So in this case, for the “Add New” toolbar item, you’ll see the following in the HTML:

<li id="wp-admin-bar-new-content" class="menupop">

Everything after “wp-admin-bar-” in the ID is the name of the node. In this case, “new-content”.

There are two methods you can use to remove a node. First, you can use the admin_bar_menu action hook to remove the “new-content” node as follows:

add_action( 'admin_bar_menu', function( $wp_admin_bar ) {
    $wp_admin_bar->remove_node( 'new-content' );
},999);

Or you can use the wp_before_admin_bar_render action hook:

add_action( 'wp_before_admin_bar_render', function() {
    global $wp_admin_bar;
    $wp_admin_bar->remove_node( 'new-content' );
},999);

You’ll need to add some additional logic, since you want to do this for a specific user role. I would advise you here to use a “capability” and not a “role”. You’ll see a lot of examples on the Internet that improperly use current_user_can() to check a role name. This should only be used to check capabilities. (See this answer.)

You didn’t indicate the role (or capability) you want to restrict the node from, but for an example, let’s assume that you want the node to only show if the user has “edit_posts” capability. Then your action function will look like this:

add_action( 'admin_bar_menu', function( $wp_admin_bar ) {
    if ( ! current_user_can( 'edit_posts' ) ) {
        $wp_admin_bar->remove_node( 'new-content' );
    }
},999);

This removes the ‘new-content’ node if the user does not have ‘edit_posts’ capability.