WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using different method to form a gallery in Wordpress, so I would like to hide an option to insert images and galleries into post for anyone but Administrator.

Can someone show me an example how it's done?

share|improve this question
up vote 1 down vote accepted

If you actually wanted to remove it instead of just hiding it you could remove the 'admin-gallery' script that is used to insert the gallery settings form. And if you wanted it to be remove only for non-admins then something like this should work:

function disable_wp_gallery()
    if( !current_user_can('manage_options') )
add_action('admin_enqueue_scripts', 'disable_wp_gallery');
share|improve this answer

To remove elements in the media editor, you can unset them. I haven't tested it for the insert button, but you can try this. Put this function in the functions.php file of your theme.

function remove_media_editor_fields($fields) {
  return $fields;

Or with CSS, for both elements you cite :

function add_custom_admin_styles() {

    if( !current_user_can('administrator') ){
        echo '
        <style type="text/css">
            #media-items #savesend .button{display:none!important;}

share|improve this answer
It doesn't work and even if it did, I believe it would remove all buttons (thumbnail and delete). As for Gallery Options, that's what I did, but I thought there's better way to do it :) – Kovas Jun 12 '11 at 20:00
I uptaded the example with a CSS fix to hide the insert button only, and the gallery settings, sorry I don't know any other way than add CSS to hide those elements. – mike23 Jun 12 '11 at 23:06

Well, I couldn't find how to unset it, so I'm using my old method:

function auto_media() {
    echo '<style type="text/css">
        #media-items .savesend input.button, #gallery-settings * {display:none;}
add_action('admin_head', 'auto_media');
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.