post_type ) ) { $id = $current_object->ID; } elseif ( !empty( $current_object->taxonomy ) ) { $id = $current_object->term_id; } elseif ( !empty( $post ) ) { $id = $post->ID; } elseif ( !empty( $_GET['tag_ID'] ) ) { $id = $_GET['tag_ID']; } else { $id = ''; } // error_log('nodes ['.implode('][',array_keys($wp_admin_bar->get_nodes())).']'); // for debugging // update the menu title, which is a different process before and after WP 3.3 if ( $wp_version >= 3.3 ) { if ( is_object( $node = $wp_admin_bar->get_node( 'edit' ) ) ) { $wp_admin_bar->add_node( [ 'id' => 'edit', 'title' => $node->title . " $id", ] ); } if ( is_object( $node = $wp_admin_bar->get_node( 'view' ) ) ) { $wp_admin_bar->add_node( [ 'id' => 'view', 'title' => $node->title . " $id", ] ); } } else { if ( is_array( $wp_admin_bar->menu->edit ) && $id ) { // is there an edit menu? $wp_admin_bar->menu->edit['title'] .= " $id"; // then append the id } } }