Skip to content

Instantly share code, notes, and snippets.

@bainternet
Created October 7, 2012 19:26
Show Gist options
  • Save bainternet/3849312 to your computer and use it in GitHub Desktop.
Save bainternet/3849312 to your computer and use it in GitHub Desktop.
Add Theme and Plugin Editor to Admin Bar (to save time!)
<?php
// Add Theme and Plugin Editor to Admin Bar (to save time!)
function admin_bar_code_editor_option() {
global $wp_admin_bar;
if ( !is_super_admin() || !is_admin_bar_showing() )
return;
$wp_admin_bar->add_menu(
array(
'id' => 'edit-code',
'title' => __('Code Editor'),
'href' => '#'
)
);
$wp_admin_bar->add_menu(
array(
'parent' => 'edit-code',
'id' => 'edit-theme',
'title' => __('Edit Theme'),
'href' => admin_url( 'theme-editor.php')
)
);
$wp_admin_bar->add_menu(
array(
'parent' => 'edit-code',
'id' => 'edit-plugin',
'title' => __('Edit Plugin'),
'href' => admin_url( 'plugin-editor.php')
)
);
}
add_action( 'admin_bar_menu', 'admin_bar_code_editor_option', 100 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment