1. Document Library Pro
  2. FAQ

Restricting access to the document library

There are many ways to restrict access to the document libraries that you have created using Document Library Pro, depending on your requirements. For example:

  • If you only use your WordPress site as a document library, then you may wish to make the entire site private.
  • If you're adding a private document library to your main company website, then you can restrict access to the documents while leaving the rest of the site public.
  • You may wish to create a document library that is part public and part private.
  • Perhaps you need to show different documents to different user groups (e.g. customers, employees, managers, etc.).

This article describes a wide range of options for restricting some or all of the document library.

Create a 100% private document library site

Some people create a completely standalone document library website, which is not used for any other purpose. If this applies to you, then you can make it completely private so that only people with the password can access the website at all.

There are 2 main ways to password protect an entire website:

  1. First, ask your hosting company if they offer .htaccess protection. If you use a managed WordPress host such as Kinsta then this is easy to set up.
  2. If that's not an option, then install the free Password Protected plugin on your WordPress site.

Once you have set up either of these options, people will be asked to enter a password when they try to access your document library website. Give the password to the people who require access.

Tip: Since the site is 100% private, you will probably also want to hide it from search engines. You can do this under Settings → Reading in the WordPress admin. 

Hide document categories behind password protection or user login

Our other plugin - Password Protected Categories - lets you password protect some or all of your documents or restrict them to certain logged in users or roles. It's an excellent way to hide parts or all of your document library without affecting the rest of your site.

  1. Install the plugin and activate your license key from the order confirmation email.
  2. Go to Documents → Categories.
  3. Edit one of the categories that you want to restrict access.
  4. Change the visibility to 'Protected' and choose one of the following options:
    • Password protected - set one or more passwords which can be used to unlock the category. Once you've done this, create a central login page and add the shortcode [category_login].
    • Roles - select which user roles should access the documents. By default, you can choose from all the default WordPress user roles. You can easily create additional roles (e.g. a 'Staff' role) with the free User Role Editor plugin.
    • Users - select individual user accounts who should be able to see the category and its documents.
  5. Repeat steps 3 and 4 for any other categories that you want to restrict. (You don't need to do this for sub-categories where you have already protected the parent category because they will automatically inherit the same protection as the parent category.)

When people visit the document library page, the documents in protected categories will not be visible. They must enter the password or login before they can see or access the documents.

Tips on structuring the private document library

  • Hiding the entire document library - Create a main 'Documents' category and add as many sub-categories as you like. Use the instructions above to protect the main category, and the sub-categories will inherit its protection.
  • Hiding specific categories only - Protect each category that you want to hide from public view, while leaving the rest set to 'Public'.
  • Showing different documents to different people - Choose a different type of protection for each category. For example:
    • You may create one set of categories restricted to the 'Staff' user role and a separate category for the 'Management' user role.
    • To create a user-specific document portal, create a category for each client and restrict it to their individual user account. Alternatively, if you don't want to create an account for each person then use the password protection option and simply give them the password.

Other membership plugins

In addition to the above, there are many plugins which you can use to restrict access to the document library. Document Library Pro works with most WordPress membership plugins.

As discussed above, Password Protected Categories is generally the simplest solution for hiding parts of the document library. Paid Member Subscriptions is excellent if you want to sell access to the document library.

Can I protect the downloadable files?

In general, no one can access files in the WordPress Media Library unless they have the direct URL. As a result, if you are using one of the above plugins to restrict access to your documents, then no one else will be able to access the downloadable files.

For an extra level of security, you can use the Prevent Direct Access (PDA) Gold plugin. We have provided a tutorial about how to use it with Protected Categories.

Related Articles

Still need help?
If searching the knowledge base hasn't answered your question, please contact support.