WordPress.org

Ready to get started?Download WordPress

Forums

How to remove "Add Media" button in WP 3.5? (6 posts)

  1. johncastlegate
    Member
    Posted 1 year ago #

    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?

  2. ClaytonJames
    Member
    Posted 1 year ago #

    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');
  3. jenkisan
    Member
    Posted 1 year ago #

    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.

  4. dung.truong
    Member
    Posted 1 year ago #

    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

  5. shippin
    Member
    Posted 1 year ago #

    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!

  6. jbx
    Member
    Posted 11 months ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic