menu->edit['title'] * v.0.2: 110224 (efc) moved to a plugin * using the $wp_admin_bar->add_menu method * v.0.1: 110224 (efc) implemented in theme */ /* * Relevant WP core files: * http://core.trac.wordpress.org/browser/trunk/wp-includes/class-wp-admin-bar.php * http://core.trac.wordpress.org/browser/trunk/wp-includes/admin-bar.php */ function efc_admin_bar_menu() { global $wp_admin_bar; $current_object = get_queried_object(); // IDs live in different places for posts or taxonomy items, why? if (! empty ( $current_object->post_type ) ) { $id = $current_object->ID; } elseif (! empty ( $current_object->taxonomy ) ) { $id = $current_object->term_id; } else { $id = ""; } // update the menu title 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 } } // note that this action will fire late, // after $wp_admin_bar has been populated add_action( 'admin_bar_menu', 'efc_admin_bar_menu', 95 ); ?>