How to remove the media library Tab from WordPress? If you’re using WordPress then It is not appropriate to use plugins for small changes. Because Complete  third party plugin increases the server load which can slow down your website.

So let’s know today how to remove the media library from WordPress. I am sure that you’ll know where to add custom script:

function remove_wp_medialibrary_tab($strings) {
          if ( !current_user_can( 'administrator' ) ) {
                       unset($strings["mediaLibraryTitle"]);
                              return $strings;
                          }
                          else
                       {
                         return $strings;
                     }
                 }
          add_filter('media_view_strings','remove_wp_medialibrary_tab');

function restrict_non_Admins(){

              if(!current_user_can('administrator')){
                       exit;
                     }
                }

          add_action('wp_ajax_query-attachments','restrict_non_Admins',1);
         add_action('wp_ajax_nopriv_query-attachments','restrict_non_Admins',1);

 

comment if you notice any type of issue . Happy Coding

Comments to: How to remove Media Library Tab from WordPress without Plugin

Your email address will not be published. Required fields are marked *

Login

welcom
....

You can make anything by Reading and Writing.
Join Aranjra

Happy

Halloween

Read and Share spooky stories with Aranjra!

Get ₹99 Bonus
On Signup