1. Home
  2. Knowledge Base
  3. Document Library Pro
  4. FAQ

Restricting access: Creating a private 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.).
  • Maybe you want to show the documents to everyone, but only allow logged in users to download them.

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. If you are creating a more fully featured members area then you can use any WordPress membership plugin that supports custom post types, such as MemberPressPaid 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 either the Download Monitor or Prevent Direct Access (PDA) Gold plugins. We particularly recommend Download Monitor because they have specifically integrated it with Document Library Pro. As a result, there's a handy 'Protect' button when you add files to your document library which makes it quick and easy to protect each file.

You should use this alongside Password Protected Categories, so Password Protected Categories restricts access to the document categories; and Download Monitor restricts access to the underlying document files in the Media Library.

How to use Download Monitor to protect your document files

From the 'Edit Document' screen in the WordPress admin, add a file upload in the usual way:

Add new file Download Monitor

Next, upload the document file, and click on the blue 'Protect' button which is added by the Download Monitor plugin:

Protect File

Clicking on the Protect button protects the file. Next, publish or save the document as usual. The document file is now protected by Download Monitor.

Can I restrict downloads to logged in users?

When you use with Password Protected Categories, it is possible to allow everyone to see the documents but only allow specific people to access the single document page or download the documents.

To do this, you need to enable the Show categories? option on the Password Protected Categories settings page. This displays the documents which are in protected categories to everyone, but if someone tries to click on a document or download it then they are prompted to login before they can access it.

Related Articles

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