Template Guard

Password protect any page or entry.

  • Protect one or more pages.
  • Protect multiple entries each with their own password.
  • Customize the login page.


Protect a single page

The easiest way to get started is by adding the following line of code to the template you want to protect.

{% do craft.templateGuard.protect('Pa$$w0rd') %}

You can also use a password that was stored on the entry.

{% do craft.templateGuard.protect(entry.myPasswordField) %}

Protect multiple pages with the same password

Here we've added a second argument, a key that identifies a group of protected pages. Add this line to every template you want to protect with that password.

Once logged in to one of those pages, you'll have access to all of the other pages in that group.

{% do craft.templateGuard.protect('Pa$$w0rd', 'secret-pages-group') %}

Protect multiple entries each with their own password

Add this line to the template(s) rendering your entries.

{% do craft.templateGuard.protect(entry.myPasswordField, entry.uid) %}


This plugin gives you access to a protect method in your templates. This will redirect users to a login page.

{% do craft.templateGuard.protect('password', 'key') %}



The password your users need to provide before accessing the page. The page will not be protected when the password is empty.


You can identify a protected area on your site using the key argument. When logged in to a page with a certain key, other pages using the same key will also be accessible. The current url is used as the default key.


Price includes 1 year of updates.
$9/year per site for updates after that.

Package Name

To install this plugin, search for its package name on the Plugin Store and click “Install”.


  • Version 1.0.0
  • Last Update 7/5/2021
  • Active Installs 20
  • Compatibility Craft 3
  • License Craft
  • Categories Security, Templating

Report an issue