Last active
September 16, 2017 20:45
-
-
Save zackkatz/9573329 to your computer and use it in GitHub Desktop.
Add link to WordPress Plugins page in top-level Admin Bar and Site Name submenu.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Add the plugin link! | |
Plugin URI: https://katz.co | |
Description: Add the plugin link to the Admin Bar | |
Author: Katz Web Services, Inc. | |
Author URI: http://www.katzwebservices.com | |
Version: 1.0 | |
*/ | |
add_action( 'wp_before_admin_bar_render', 'kws_add_plugin_menu_link' ); | |
/** | |
* Add the Plugins link for goodness sake! | |
*/ | |
function kws_add_plugin_menu_link() { | |
global $wp_admin_bar; | |
//Add a link called 'Plugins' in the top-level menu | |
$wp_admin_bar->add_node(array( | |
'id' => 'kws-plugins', | |
'title' => __('Plugins'), | |
'href' => admin_url('plugins.php') | |
)); | |
// And have the same link available in the submenu of the site name | |
$wp_admin_bar->add_menu( array( | |
'id' => 'kws-plugins-sub', | |
'title' => 'Plugins', | |
'href' => admin_url('plugins.php'), | |
'parent'=>'site-name' | |
)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I just slap this bad-boy in the
mu-plugins
folder.