Perhaps you could use $wp_admin_bar->get_nodes();
to get all toolbar nodes, then loop them through and modify the right nodes as needed. Something along these lines,
add_action( 'admin_bar_menu', 'customize_my_wp_admin_bar', 80 );
function customize_my_wp_admin_bar( $wp_admin_bar ) {
$all_toolbar_nodes = $wp_admin_bar->get_nodes();
if ( ! $all_toolbar_nodes ) {
return;
}
foreach ( $all_toolbar_nodes as $node ) {
// Skip nodes you don't want to edit
if ( ! $some_logic ) {
continue;
}
//Change target
$node->meta['target'] = '_blank';
//Update Node.
$wp_admin_bar->add_node($node);
}
}
I can’t remember what properties $node
has, but I guess there’s some sort of parent
property that you can use in the if
statement to skip the wrong ones.