How To Remove Media Upload Buttons in Post Editor

Written by Jean Galea
Written by Jean Galea
In the WordPress admin screen, when working in the post or page editor, you will see some media upload buttons above the TinyMCE editor. If you would like to hide them from your client, for example to disable the upload of such files, you can follow the steps in this post.

Partner Sponsors

BionicWP

Full disclosure: If you purchase through a link on our site, we may earn a commission. Learn more.

In the WordPress admin screen, when working in the post or page editor, you will see some media upload buttons above the TinyMCE editor. If you would like to hide them from your client, for example to disable the upload of such files, you can follow the steps below:

To Remove All Media Buttons

[php]
add_action(‘admin_init’, ‘remove_all_media_buttons’);

function remove_all_media_buttons()
{
remove_all_actions(‘media_buttons’);
}
[/php]

To Remove Only Some Buttons

In this case we need to add an admin stylesheet, so in your functions.php file paste the following:

[php]
add_action(‘admin_init’, ‘my_admin_stylesheet’);

function my_admin_stylesheet()
{
wp_enqueue_style(‘my_admin’, get_bloginfo(‘template_url’).’/css/my_admin.css’);
}
[/php]

Then create a file called my_admin.css within the ‘css’ folder of your theme, and insert the following:

[css]
<code>/* Hide the buttons you want */
#add_image { display:none; }
#add_video { display:none; }
#add_audio { display:none; }
#add_media { display:none; }
[/css]

If you enjoyed this post, make sure to subscribe to WPMayor’s RSS feed.

This article was filed in our archives.
Written by Jean Galea
Jean Galea is an investor, entrepreneur, and blogger. He is the founder of WP Mayor, the plugins WP RSS Aggregator and Spotlight, as well as the Mastermind.fm podcast. His personal blog can be found at jeangalea.com.

In this article

Discover More

4 Responses

  1. Thanks for this Jean!
    I was looking for a filter hook to remove this and wasn’t having any luck since the only test to prevent it from rendering is “if( !current_user_can(‘upload_files’))” and trying to hook anything involved with the checking didn’t work. (not sure what I was missing)

    After giving Google a go, I found your post and it worked like a charm!
    The only catch I see is it still requires adding CSS to hide the container div for it (at least in the 3.3-dev version), but at least the buttons are gone.

    Thanks again.

  2. Thanks for the tip on removing the GUI buttons. Since it requires a custom css, does this work for if the user might happen to switch themes? (I’m trying to prevent upload). And also does it prevent access to media from the left nav bar, or just the editor?

    1. It prevents access from just the editor, with this method it will stop working when user switches themes.

Share Your Thoughts

Your email address will not be published. Required fields are marked *

New discoveries, every week.
Join thousands of designers, developers, and builders that come to WP Mayor to find the best guides, tools, and services for their next website. One email, once a week.
WP Mayor Newsletter

Claim Your Free Website Tip 👇

Leave your name, email and website URL below to receive one actionable improvement tip tailored just for your website within the next 24 hours.

"They identified areas for improvement that we had not previously considered." - Elliot

By providing your information, you'll also be subscribing to our weekly newsletter packed with exclusive content and insights. You can unsubscribe at any time with just one click.

What's missing?