/** Add Media Library & Plugins to Main Menu of Admin Bar */
if ( ! function_exists( 'x_add_options_item_to_admin_bar' ) ) {
function x_add_options_item_to_admin_bar() {
global $wp_admin_bar;
$wp_admin_bar->add_menu(
array(
'parent' => 'site-name',
'id' => 'x_library',
'title' => __( 'Media Library', 'x' ),
'href' => esc_url( admin_url( 'upload.php' ) ),
'meta' => false
// array of any of the following options: array( 'html' => '', 'class' => '', 'onclick' => '', target => '', title => '' );
)
);
$wp_admin_bar->add_menu(
array(
'parent' => 'site-name',
'id' => 'x_plugins',
'title' => __( 'Plugins', 'x' ),
'href' => esc_url( admin_url( 'plugins.php' ) ),
'meta' => false
// array of any of the following options: array( 'html' => '', 'class' => '', 'onclick' => '', target => '', title => '' );
)
);
}
add_action( 'wp_before_admin_bar_render', 'x_add_options_item_to_admin_bar' );
}