A need for you to restrict 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:
Content to restrict to registered & logged in users
To restrict content to non-logged in users, use the shortcode
[pp-non-logged-users] like so.
Content to restrict to non-logged in 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 a post or page, simply insert the shortcode
[pp-redirect-non-logged-in-users] to the said post or page. And if you want them redirected to a custom URL, use the shortcode as like so:
To redirect only logged in users to a custom url, use the shortcode
pp-redirect-logged-in-users like so:
Remember, if the user isn’t logged in, no redirection will occur.
If you have any pre-purchase question, inquiring or contribution, let us know in the comments or shoot us a mail via support[at]profilepress.net
Tags: restrict content