wordpress snippets last updated   : January 29, 2015
we now have 646 snippets

Restrict user access to specific templates

wordpress snippet

This is a slight modification of a great little snippet by Elliott Richmond I just changed “include” to “get_template_part”. Create a new template file and drop in this snippet and you can restrict user access to this template. Don’t forget to change the template name at the top. You will of course also need to create a template file called error.php or the other option is to use something like “wp_die(‘You don’t have access.’)” instead of loading a template.

read more