Support » Plugins » Hacks » How to remove "Add Media" button in WP 3.5?

  • In previous versions of WordPress, I could remove the media upload button with something like:

    function z_remove_media_controls($context) {
        return;
    }
    
    add_action('media_buttons_context', 'z_remove_media_controls');

    However, this does not seem to work in WordPress 3.5. How can I remove or hide the button now?

Viewing 5 replies - 1 through 5 (of 5 total)
  • I think media_buttons_context has been deprecated.This seemed to work for me on 3.5.

    function z_remove_media_controls() {
         remove_action( 'media_buttons', 'media_buttons' );
    }
     add_action('admin_head','z_remove_media_controls');

    Its a bit of time, but lets say I want to remove only the Add Media button from the Posts page and not the New Page page?

    Thanks.

    From WP 3.3, we can toggle the ‘Add Media’ button by using ‘media_buttons’ settings.

    $editor_settings = array('media_buttons' => false);
    wp_editor($post_content, 'content_id', $editor_settings);

    http://codex.wordpress.org/Function_Reference/wp_editor

    shippin

    (@shippin)

    Hey guys,

    I also like to hide the “Add media” button.

    Can you please explain where I paste the code dung/truong shared?
    Is it ready like that, or anything needs to be added before or after it?

    Thanks!

    Just put ClaytonJames’s code in your theme’s functions.php file and it will work. (Just tried it on version 3.5.2)

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to remove "Add Media" button in WP 3.5?’ is closed to new replies.