ThemeNcode Docs

Restrict By File Type

Estimated reading: 2 minutes

Sometimes, you may only want to restrict a specific file type. For example, you may only want to restrict PDF files to keep those protected and use in PDF viewer for WordPress Plugin

On this page, you can set access options for all file types you’ve uploaded to your Media Library. The plugin will check the media library and automatically generate and display the settings for each of the file types you have on your website.

Settings on this page are used when a file doesn’t have access settings at an individual level.

Settings are pretty much the same as Individual File Access Settings.

1. Require Login for this file: Check this if you want files of this file type to be only accessible by Logged in users. Users who are not logged in will get a 404 error when they browse the file URL

2. Restrict By: You can restrict files by Users, User roles, WooCommerce ( if enabled ), and Paid Membership Pro ( if enabled). Select the one that you want to use.

3. Access Type: This setting is related to the next 2 settings (User Roles and Users). This field will tell those fields about what to do with their data.
If you choose to allow this here, the roles and users you assign on the next 2 fields will have access to files of this file type.
If you choose to disallow here, the roles and users you assign on the next 2 fields won’t have access to files of this file type.

4. Select User Roles: Select the roles that should or should not (based on the access type above) have access to files of this file type

5. Select Users: Search and select the users that should or should not (based on the access type above) have access to files of this file type. You can search by user’s id, name, email, etc.

Once you’re done setting up the restrictions for the file, hit Save Changes and you’re all set! Test any file on your browser and it should have the restrictions applied.

Leave a Comment