1

I would like to remove some of the media upload buttons just above TinyMCE in the Add post screen, how can I do that? Thanks.

3

If you want to get rid all all media buttons, you can remove the media_buttons action:

add_action('admin_init', 'remove_all_media_buttons');

function remove_all_media_buttons()
{
    remove_all_actions('media_buttons');
}

Since you only want to remove some buttons, I suggest adding an admin stylesheet:

add_action('admin_init', 'my_admin_stylesheet');

function my_admin_stylesheet()
{
    wp_enqueue_style('my_admin', get_bloginfo('template_url').'/css/my_admin.css');
}

In the my_admin.css you can hide the buttons:

/* Hide the buttons you want */
#add_image { display:none; }
#add_video { display:none; }
#add_audio { display:none; }
#add_media { display:none; }
2
  • 1
    just for the record, you can fine tune the script loading this way global $current_screen; switch ($current_screen->id) { case 'page': case 'post': wp_enqueue_style('my_admin', get_bloginfo('template_url').'/css/my_admin.css'); break; }
    – brasofilo
    Mar 29 '12 at 1:12
  • is there any new solution for current version (3.5) of wordpress?
    – Sisir
    Mar 4 '13 at 18:07
1

Or simply upgrade to WordPress 3.3 that got rid of that.

0

In case someone wants to remove the media button on latest version of wordpress. Below is example for removing it for only posts. You can remove the if statement to make it disappear for all post types. Or add a CPT name if you want it remove on a CPT.

add_action( 'admin_head' , 'product_remove_editor_upload' );
function product_remove_editor_upload(){
    global $post;
    if(isset($post) && $post->post_type ==  'post'){
        remove_action( 'media_buttons', 'media_buttons' );
    }
}

Tested in 3.5.1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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