Search
Close this search box.

How To Remove Media Upload Buttons in Post Editor

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.
Table of Contents

Sponsored Ad

If you purchase through a link on our site, we may earn a commission.

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.

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.

Sponsored Ad

If you purchase through a link on our site, we may earn a commission.

All suggestions are anonymous.

More from our blog...

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.

Post a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Stay updated with WP Mayor's newsletter showcase every week

Stay on top of every new WordPress innovation and latest launches. Receive all our fresh product reviews and expert guides directly in your inbox.

Hosting Survey 2024

Are you happy with your hosting provider or are you over-paying for too little? Have your say below!

"*" indicates required fields

What's the main reason you picked this host?*
How happy are you with your host?*

OPTIONAL: If you'd like to receive the results of this survey, please enter your details below.