Created
February 29, 2024 16:34
-
-
Save jb510/fb02c57e4456b515f4eb74e13aa458c0 to your computer and use it in GitHub Desktop.
Add Plugins menu item to top level admin bar in WordPress
This file contains hidden or 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 | |
/** | |
* Customize admin bar items | |
* | |
* @since 1.0 | |
* @author Jon Brown | |
* @global array $wp_admin_bar | |
*/ | |
function s9_customize_admin_bar_items() { | |
global $wp_admin_bar; | |
if ( current_user_can( 'activate_plugins' ) ) { | |
$wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'plugins', 'title' => __( 'Plugins' ), 'href' => admin_url( 'plugins.php' ) ) ); } | |
} | |
add_action( 'wp_before_admin_bar_render', 's9_customize_admin_bar_items' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment