Add Media Link To Admin Bar

smartsovereign
31 May 2022

This code allows you to add a link to ADD MEDIA from Admin Toolbar, because going all the way to the left and hovering over options is too much work.

Set to load in Admin Area only

<?php

// add a link to the WP Toolbar
function custom_toolbar_link($wp_admin_bar) {
    $args = array(
        'id' => 'Media',
        'title' => 'Add Media', 
        'href' => '/wp-admin/upload.php', 
        'meta' => array(
            'class' => 'Media', 
            'title' => 'Upload Media'
            )
    );
    $wp_admin_bar->add_node($args);
}
add_action('admin_bar_menu', 'custom_toolbar_link', 999);

Was this article helpful?

Tags

Categories

Never miss new post again

Subscribe and get list of new posts in your inbox

Click to Copy