A need for you to restrict the content of a post, page, custom post type or widget in your WordPress powered website may arise.
In this tutorial, I will be showing us how to restrict content to either logged in users or non-logged-in users via a set of ProfilePress shortcodes.
To restrict content to registered and logged in users, use the shortcode
[pp-logged-users] like so:
[pp-logged-users] Content to restrict to registered & logged in users [/pp-logged-users]
To restrict content to non-logged-in users, use the shortcode
[pp-non-logged-users] like so.
[pp-non-logged-users] Content to restrict to non-logged in users [/pp-non-logged-users]
Note: you can use these shortcodes in WordPress posts, pages, custom post types and in widgets (well not without a plugin such as this).
How about if you wish to redirect unregistered or non-logged-in users to your website login page when they try to access any or specific posts, pages, custom post types and archive?
To do this, you need to create a content protection rule.
Go to Content Protection >> Add a Protection Rule
Select the posts, pages or whatever it is you want to restrict, define who can see the content and what happens to unauthorized users which can either be to redirect them to your login page or custom URL or display a message to them.
You can also restrict content based on user roles.
If you have any pre-sale question, inquiring or contribution, please get in touch.