How can I limit access to uploaded media depending on the logged in user’s user role?


I have a pretty straight-forward WordPress site that uses a plugin called Subway to restrict access on the page only to logged in users. There’s also the following .htaccess-rule:

RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$ [NC]

I can define access depending on user role very easily. However, it doesn’t seem to work so well with Media attachments.

I am a bit new to Filters in WordPress, but shouldn’t there be a way to restrict access to a file based on a user’s user role via functions.php?


, , Oleg 3 years 2020-03-30T04:51:13-05:00 0 Answers 89 views 0

Leave an answer