How to only current user Media Library (upload.php)

This will customize way in the list of only the current user of the Media Library of admin screen.

 

 

Customize the Media Screen of current user

Customize the Media Screen of current user

 

 

 

 

Step1 Change the user capabilities

 

It will change the capability of the user role group for which you want to view only their own posts.

For example in the case of the Editor, remove the below capabilities.

  • delete_others_posts
  • edit_others_posts

 

 

Step2 Set the current user id of Media Library

 

Please add code to functions.php of your theme.

 

 

It looks like this.

 

 

Current user media of List

Current user media of List

 

 

It looks like complete. But the number of filter search is different current user media.
The next step is to remove this.

 

 

 

Step3 Remove to the Filter search

 

First of all it will remove the Dropdown select of date.

Please add add code to custom_load_edit function.

 

 

And please add code to functions.php.

 

 

It looks like this.

 

Remove drop down select menu

Remove drop down select menu

 

 

Next, Attachment filter does not have disable filter like the All dates. So it need to hide in the CSS.

Please add code to custom_load_edit function.

 

And please add code to functions.php.

 

It looks like this.

 

Remove Filter Search

Remove Filter Search

 

It looks like has been completed in this. But grid view is not good.

 

Default Grid View

Default Grid View

 

 

So next will customize the grid view.

 

 

 

Step4 Remove to the Search butons of grid media library

 

Grid view of Media Library is not have filter. So, remove the buttons to style of CSS.

Please add code to style of custom_admin_print_styles function.

 

 

It looks like this.

 

Remove search buttons of Grid view

Remove search buttons of Grid view

 

 

 

Step5 Only current user media list

 

Please add code to functions.php.

 

It looks like this.

 

User ID 2 Screen

User ID 2 Screen

 

User ID 3 Screen

User ID 3 Screen

 

Insert Media Screen of Add New Post

Insert Media Screen of Add New Post

 

 

 

 

This is complete! 🙂

 

Full code is here. Please refer to this.

 

 

 

 

 

 

 

Leave a Reply

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


*