Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

How to Add the Theme Editor in WordPress Admin Bar

Last updated on by
Elegant Themes
How to Add the Theme Editor in WordPress Admin Bar

In the past we have shown you how to add the shortlink menu, draft posts, and other things to the WordPress admin bar. In this article, we will show you how to add the Theme Editor in WordPress Admin Bar.

All you need to do is either open your site-specific plugin or your theme’s functions.php file and paste the following code:

// Add Theme Editor to Admin Bar (to save time!)
function admin_bar_theme_editor_option() {  
	global $wp_admin_bar;   
		if ( !is_super_admin() || !is_admin_bar_showing() )      
		return;    
		$wp_admin_bar->add_menu(        
			array( 'id' => 'edit-theme',            
			'title' => __('Edit Theme'),
                        'href' => admin_url( 'theme-editor.php')       
		)    
		);
	}

add_action( 'admin_bar_menu', 'admin_bar_theme_editor_option', 100 );

That is it. We found this code floating around on the WordCamp Nashville Hashtag. We tried it on WordPress 3.3.2 and it works. The code should work for other versions as well.


Editorial Staff at WPBeginner is a team of WordPress lovers led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »
  • something4ken

    Very helpful. It saves me about 2 clicks.

  • http://zslabs.com/ Zach

    I think it’d be better to use admin_url() instead of get_blogoinfo() in this case: http://codex.wordpress.org/Function_Reference/admin_url

    • http://www.wpbeginner.com/ wpbeginner

      Agreed. Just updated the code.