Dec 4, 2011

WordPress tip: Restrict user access to specific templates


 
WordPress tip: Restrict user access to specific templates
Published on WpRecipes.com | shared via feedly

Simply create a new page template and paste the following at the very beginning of the file:

 <?php /* Template Name: Restricted to Authors only */  if ( !current_user_can('author')) { 	wp_die('You don't have access to this page.') } ?> 

Thanks to Kevin Chard for this snippet!

Looking for WordPress hosting? Try WP Web Host. Prices starts at $5/month and you can try it for free!

WordPress tip: Restrict user access to specific templates