WP Admin Bar – Get current theme name as custom menu title

First thing get_current_theme() is deprecated since version 3.4 you need to use wp get theme() to get the current theme name.

And about add_menu() you can only use it at action hook admin_bar_menu as codex say about it:

This is not a function. It is a method of the $wp_admin_bar global (an instance of WP_Admin_Bar), which may not exist except during the ‘admin_bar_menu’ hook.

Working example

function foo_test_menu() {
    global $wp_admin_bar;
    $current_theme = wp_get_theme();
    $wp_admin_bar->add_menu( array(
        'id' => 'your_menu_id',
        'title' => $current_theme->get('Name')
    ) );   
}
add_action('admin_bar_menu', 'foo_test_menu');

techhipbettruvabetnorabahisbahis forumutaraftarium24edueduseduedusedueduseduseduseduedus