• I need some help to try and hide or unset the .media-menu element and to style the .media-frame-content (left side panel of media upload mgr). I’d also like to hide the set featured image meta link… ideally hiding both of these from anyone that is not an admin (update core)

    I’ve tried a small plugin and child theme colors css file to the point of exhaustion…

    Is there a simple function edit that I can put in my child function file that will hide the tab and set featured image meta link?

    I user twenty ten with wp property. Thank you for any guidance.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter jimii

    (@jimii)

    I found a post helpful to unset the “insert from url” link which is part of my initla question – so….

    My revised question is – how to I safely incorporate removal of the other media menu links into unset function without creating a fatal error?

    To unset the “insert from url” link, consumedesign provided the following in a post from a year ago:

    function remove_media_tab($strings) {
    	unset($strings["insertFromUrlTitlesetFeaturedImageTitle"]);
    	return $strings;
    }
    add_filter('media_view_strings','remove_media_tab');

    It works great to unset that function. Can I safely change this to become:

    function remove_media_tab($strings) {
    
    	unset($strings["insertFromUrlTitle"]);
             unset($strings["setFeaturedImageTitle"]);
             unset($strings["createNewGallery"]);
    	return $strings;
    }
    add_filter('media_view_strings','remove_media_tab');

    Is this correct or is there a more efficient way to do this? Ideally I would just unset these from non-admins – but at present I’d be happy just to make them disappear. thank you for any help able to be provided.

    Thread Starter jimii

    (@jimii)

    Correction – the good code solution provided by consumedesign was as below and NOT as I had incorrectly posted above:

    function remove_media_tab($strings) {
    	unset($strings["insertFromUrlTitle"]);
    	return $strings;
    }
    add_filter('media_view_strings','remove_media_tab');

    My apologies for any confusion with that.

    Update: I was able to unset the “Create Gallery” and the “Set Featured Image”. However it left 2 links behind titled “Media Library” … I’m close but not experienced enough to maneuver through this…. Can someone guide me on how to make these links or the side media panel on the media up-loader disappear…?

    Code used unset the “create gallery, set featured image and insert from url” was modified as follows:

    function remove_media_tab($strings) {
    	unset($strings["insertFromUrlTitle"]);
             unset($strings["setFeaturedImageTitle"]);
             unset($strings["createGalleryTitle"]);
    	return $strings;
    }
    add_filter('media_view_strings','remove_media_tab');
    ?>

    thank you….

    Thread Starter jimii

    (@jimii)

    This has gotten frustrating as I just want to restrict media upload to the basic functions of the media up-loader – meaning media library and upload images.

    Ideally this would apply to anyone not an admin (cannot update core) – but I’d be satisfied to just unset them first and work out the if admin later…

    From another post by consumedesign to unset the upload from url and I modified that code to take into account the feature image and gallery as below. It worked to unset the upload from url – but the other two (create gallery and feature image links) left 2 ‘media library’ links behind… The function code I used was:
    function remove_media_tab($strings) {
    unset($strings[“insertFromUrlTitle”]);
    unset($strings[“setFeaturedImageTitle”]);
    unset($strings[“createGalleryTitle”]);
    return $strings;
    }
    add_filter(‘media_view_strings’,’remove_media_tab’);
    ?>

    I still struggle with code so I’ve trial and errored my way to this point and I am lost at how to finish this.

    Is there a better way to unset / hide the wp side-panel links for upload from url, create gallery and set featured image? Thank you for any guidance that can be provided.

    Moderator bcworkz

    (@bcworkz)

    If you print_r($strings); from inside the filter, all strings you have control over will be printed at the top of the add new post page. View page source for a more organized view.

    I suggest you first try setting the strings you do not want to an empty string before resorting to unsetting them. An unset variable could cause PHP warnings where an empty string would not. Only if the empty string still causes problems should you use unset.

    There may be a better way, but I’m unaware of one. As long as you are not getting any notices or warnings with WP_DEBUG defined as true in wp-config.php, there’s nothing wrong with doing things this way, assuming it otherwise works for you of course.

    Thread Starter jimii

    (@jimii)

    thank you bcworkz – I appreciate the suggestions you’ve made and am going to look-up and try the empty string option.

    I haven’t done that before so will see if i can find enough to figure it out and try it. I’ll update here on results.

    Great! And, how to add a new item?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Want to hide-unset media-menu & set featured img tab on upload mgr’ is closed to new replies.