Post&Term Restriction Content settings
Ultimate Member provides the ability to customize the visibility of the posts (post, page, 3rd-party CPT post) using the settings below.
Restrict access to this post?/Restrict access to this term and its posts?
This enables the admin to set restriction settings for the individual post or term.
Please note that individual post settings have the highest priority. So, if you checked the "Restrict access to this post?" checkbox, then the settings of the terms of this post are ignored.
Who can access this post?/Who can access this term and its posts?
- Everyone – Everyone is the default state for post/term and means that everyone who visits your site will see this post. Its data, comments, etc.
- Logged out users – If you select this option, it means that this post/term will only be visible to visitors (e.g logged out users). When someone logs into your site they will no longer see this post/term.
- Logged in users – If you select this option, it means that this post/term will only be visible to logged in users. Visitors and non-members will not see this block content. Once the "Logged in users" option is selected, you will see the "Select which roles can access this post/Select which roles can access this term and its posts" setting which shows all roles on your site. If you want to show a post/term to a certain role(s) then you can select the roles that will be able to see the post/term.
Lock content to verified accounts only?
There is possible to show the content only for verified users ( Ultimate Member - Verified Users extension).
Would you like to display 404 page when users haven't access?/Would you like to display 404 error on the term's archive page and terms' posts single pages when users haven't access?
Recommended to be enabled. Restricted post's and term's archive page and all terms' posts will be hidden by exclusion from WP Query. The safest and most effective method that hides posts and their comments from all requests, RSS feeds, etc. on your site. This setting hasn't affected the restricted term archive page. It's hidden by default if the term is restricted (see the "Restrict access to this term and its posts?" option).
What happens when users without access try to view the post?/What happens when users without access try to view the term's post?
There is the ability to select actions if the post/term isn't removed from the query. Make this action if the post/term's is restricted according to the conditions:
- Show access restricted message – It means that visitors can see the restricted message instead of the post content. Once the "Show access restricted message" option is selected, you will see the "Restricted access message type" setting which provides to select the restricted message type (Global or Custom). And once the "Custom message" option is selected, you will see the "Custom restricted access message" setting which provides to type the custom message.
- Redirect user – It means that visitors will be redirected from the single post page instead of the displaying it. Once the "Redirect user" option is selected, you will see the "Where should users be redirected to?" setting which provides to select "Login page" or "Custom URL" redirect. And once the "Custom URL" option is selected, you will see the "Redirect URL" setting which provides to type the URL where the visitor will be redirected.
By default, the restricted post if isn't hidden in the query has a pre-defined restricted data array.
- $post->post_title - replace by the "Restricted Access Post Title" setting value.
- $post->post_content - replace by the "Restricted Access Message" setting value. (Custom individual for post or term. Or global restricted message from Ultimate Member > Settings > Access tab)
- $post->post_excerpt - replace by empty string to avoid the displaying restrcited content in archive.
If you need to customize the WP_Post object of the restricted post. Please use the sample from this Gist.