Introduction
WPO365 Audiences can be used to require users to login before they are allowed to view the content. This is called a Private Page, which should not be confused with a privately published WordPress page (which is a page that can only be viewed by administrators).
Please note that you can only require user-login for a post or page if you have selected Internet or Internet (auth. only) as Authentication scenario on the WPO365 Single Sign-on configuration page.
Configuration
Perform the following steps, if you want to enable content creators such as authors, to limit access to a page to logged in users.
- Go to WP Admin > WPO365 > User Registration and scroll to the Audiences section.
- Ensure that WPO365 Audiences are enabled.
- Locate the Response for visitors requesting a page that requires a logged-in user setting and select which of the three options meets your requirements best:
- 404 Not Found
- Redirect to login page (with a message that the page in question requires the user to sign in)
- Redirect to Microsoft
- Continue to the Excluded roles setting and select the roles that should not be affected by WPO365 Audiences. You can limit that exclusion to certain post types, or alternatively select All Post Types. In the below example, an administrator has been excluded for all post types. Hence an administrator will be able to see all posts and pages.
- Finally, check the option Enable audiences for WP-REST if you want WPO365 to apply the same restrictions to content requested via the WordPress REST API.