WordPress integrates six default roles: Administrator, Editor, Contributor, Author, subscriber and sixth multi-role: Super Admin which have all privileges under WordPress blog.
In this tutorial we will see how to create a new role for your website subscribers and how to display the content according to the new role.
Why would you need to create a new role in WordPress blog?
Apart from enhancing the WordPress security, we could give you a lot of reason to create a new role for subscribers. However in this tutorial we will give you one good example on how to keep the default subscriber role but also create a premium subscription to monetize your blog. So if you have a blog where you want to give access to certain articles or special offers only to people to have paid monthly subscription for example, they can have this custom-built new role in WordPress blog.
To create this new role (Premium Subscription) in WordPress you will need to add the following code in function.php file of your WordPress theme:
// Add a role
add_role(‘premium_user’, ‘Premium Subscription’, array(
‘read’ => true, // true : Allow reading of article page
‘edit_posts’ => false, // false : Forbidden to add articles or pages
‘delete_posts’ => false, // false : Forbidden to remove articles or pages
Add_role : premium_user identifier will be our new role and Premium Subscription is the name of the role that I attribute to my future subscribers who want this subscription.