Looking for an easy way to set up WordPress restrict page access to logged-in users functionality? If you run a community site on top of WordPress which allows user registration, you probably need a simple way to control which users can access certain private pages of your WordPress site. For this, you’ll need a plugin that lets you manage user-specific content in WordPress.
In this tutorial, we’ll show you how to easily restrict specific page access to logged-in users, or restrict content to specific users in WordPress using the Profile Builder plugin.
You’ll have everything set up and ready by following the 3 easy steps in the tutorial below…
Profile Builder: The Easiest Way to Restrict Page Access to Logged-in Users in WordPress
Profile Builder gives you a simple way to customize all parts of the WordPress login and registration process, including setting up WordPress restrict page access to logged-in users functionality.
With this easy-to-use plugin, you can:
- Create a user-friendly custom login page or custom registration page;
- Redirect users after they submit the login form or registration form;
- Collect additional user profile information about your users by setting up custom fields;
- Let registered users manage all their profile information (such as their username, password, and account details) from a simple front-end interface;
- Create custom WordPress user roles to restrict user access to private pages or set up different membership levels;
- Integrate with other community plugins, like BuddyPress.
And with Profile Builder’s Content Restriction feature, you can restrict page access to logged-in users and manage user-specific content in WordPress.
In addition to restricting access by a user’s logged-in status, you can also set up other types of restriction functionalities like:
- WordPress restrict content to specific user OR WordPress restrict page access to certain users.
- WordPress restrict access to page by role.
Profile Builder can help you create your own custom user roles if needed, which lets you create as many roles as needed to properly limit access to your WordPress content.
Below, we’ll show you how to set up WordPress restrict page access to logged-in users functionality in just a few steps…
WordPress Restrict Page Access to Logged-in Users Tutorial
1. Enable Content Restriction Feature in Profile Builder
Then, under the Profile Builder menu item, navigate to Settings and, in the Content Restriction tab, make sure you Enable Content Restriction.
2. Set up Custom Restriction Messages
After activating the restrict content feature, in the same tab, you can go on and set up the type of restriction, as well as customize the default restriction messages users will see if they don’t have access to certain content. The settings available in the back-end are simple and easy to configure.
You can also choose to display a short preview of the restricted content if you want people to be able to find the content by searching on Google.
Based on these settings, if a non-logged-in user wants to access the restricted content, he will get a short preview containing the first 20 words or any number set in the settings. It will look something like this on your site’s frontend:
To deliver a good user experience, you can add a login form or a registration form to a sidebar widget. This way, users can quickly log into their account or register for an account to view the exclusive content. With Profile Builder Pro, you can do this using the [[wppb-login]] for custom login forms, or [[wppb-register]] shortcode for custom registration forms.
3. Set Up Content Restriction Rules
After setting up the restriction messages, in your WordPress admin panel simply navigate to each individual page, post, or custom post type you want to restrict. Below the content editor, you’ll notice a meta box called “Profile Builder Content Restriction“.
Here, you can set up both WordPress restrict page access to logged-in users functionality and WordPress restrict content to specific user by role functionality.
- If you want to restrict access to any logged-in user, check the box for Logged in Users.
- If you want to restrict access to specific user roles, check the boxes for the specific roles that you want to grant access to.
In the example below, the page content will be available for all our logged-in users that have the user role of “Administrator” or “Author” attributed.
Furthermore, if you want to customize the restriction message for this specific page or post, you can type in something different than the default message.
Also, if you want to send your users to another page (for example the homepage), you can enable the redirect feature. In the example below, we will redirect all of the users that don’t have the following roles assigned: Editor, Subscriber, SEO Manager, or SEO Editor.
Note: You can replicate the same steps for restricting content based on user role for any specific post, page, or custom post type on your website. This way, you can grant different user roles access to different premium content on your website.
With the Profile Builder WordPress plugin, it’s easy to restrict page access to logged-in users or just certain users with specific user roles.
You can use this functionality in multiple scenarios, from providing members-only content, to restricting access to personal or confidential data, or simply setting a WooCommerce store to only be available to members. This also encourages users who don’t already have an account to create one. As we mentioned above, you can simply add a login or registration form to the sidebar widget or any other widget on your WordPress site. To do this, simply use the [[wppb-login]] or [[wppb-register]] shortcodes.
Get started with Profile Builder by clicking the button below:
And if you want even more flexibility to create private content and premium content on your membership site, you might benefit from a full WordPress membership plugin. In that case, you should check out the Paid Member Subscriptions plugin.
This plugin builds on the content restriction functionality in Profile Builder and also lets you sell access to your content on a one-time or recurring basis (including tracking the IP addresses of all the people who make a purchase). In other words, you won’t have to hire a WordPress developer to add advanced features to your website.
The Profile Builder plugin supports integration with Paid Member Subscriptions giving you the best of both worlds.
Are you currently restricting access to parts of your website or managing user-specific content on your WordPress website? Let us know your ideas and methods in doing so in the comments section below.
Subscribe to get early access
to new plugins, discounts and brief updates about what's new with Cozmoslabs!