Blog

Control wp media files by specific user

As my previous post , i explained  how to use WordPress media file uploader. with this script you can WordPress media uploader manager as per your requirement but in that  post you can not control the files by specific users.

Now we can control WordPress media file manager and images and files by user specific.For that we have to use hook up the pre_post_query  that  is action that filter WP Query Object.We have to just pass current logged in user’s ID in WP Query set. Copy and paste this script into your theme’s functions.php.

 

Note : This hook every where apply when a user is logged in means it will effect for wp query and this wp query used by post query , search query, fetch media files.So please use  page screen condition for this Hook.

Leave a Reply

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

Security *