12% off of LTD using this coupon: TWELVEPERCENTOFF. Promo ends on 2 Dec midnight UTC.
Published on Jul 31, 2018

How to add “Templates” admin bar menu item in WordPress

Sridhar Katakam

When working with Oxygen, we need to go to Oxygen > Templates page in the admin several times especially during the initial stages of the development.

Wouldn’t it be handy to have a link in the WordPress admin bar that takes us to the Templates page so we can just go there with a single click regardless of where we are on the WP admin or frontend?

The code snippet below does just that.

add_action( 'admin_bar_menu', 'custom_add_templates_adminbar_item', 1001 );
 * Adds "Templates" menu item in the WordPress admin bar.
 * @param WP_Admin_Bar $admin_bar WP_Admin_Bar instance, passed by reference.
function custom_add_templates_adminbar_item( $admin_bar ) {

            'id'    => 'templates',
            'title' => 'Templates',
            'href'  => admin_url( 'edit.php?post_type=ct_template' ),
            'meta'  => array(
                'title' => __( 'Oxygen Templates' ),


Code like this can be added using the Code Snippets plugin or a custom functionality plugin.