Add Shortcuts on WordPress Admin Bar

If you find yourself constantly modifying plugins and style sheets, you might want to make the process of navigating from the homepage to the options page a bit faster. You can easily add shortcuts to the admin bar by adding this code in your functions.php file.

function add_admin_bar_shortcuts() {

   if ( current_user_can( 'edit_theme_options' ) ) {
     global $wp_admin_bar;
     $wp_admin_bar->add_menu( array(
       'parent' => 'appearance',
       'id' => 'theme_editor_admin_bar',
       'title' => 'Editor',
       'href' => admin_url( 'theme-editor.php')
     $wp_admin_bar->add_menu( array(
       'parent' => 'appearance',
       'id' => 'plugins_admin_bar',
       'title' => 'Plugins',
       'href' => admin_url( 'plugins.php')
add_action( 'wp_before_admin_bar_render', 'add_admin_bar_shortcuts' );

Using the code above adds two additional menu items, shortcuts to the Plugins page and the Editor page. You can follow the format and add additional shortcuts of your choice.
Change the value of href to your desired address.

'href' => ''

Share This Post

Leave a Reply

Please write your comments in english. I delete anything that even remotely resembles spam.

Note: When posting code, enclose it in pre and code tags.
e.g. Add code here