Hide “Gallery Settings” and “Insert into Post” button from Attachment window

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?

3 Answers
3

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') )
        wp_deregister_script('admin-gallery');
}
add_action('admin_enqueue_scripts', 'disable_wp_gallery');

Leave a Comment