Looking for an easy way to set up the 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 the 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 the 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
To get started, make sure to install and activate the Profile Builder plugin. The content restriction feature is available in both the free and Pro versions of the plugin.
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 front end:
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. Alternatively, if you’re using Gutenberg, you can simply look for the Login and Register premade blocks and add them to your site.
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 dedicated Gutenberg blocks or the shortcodes.
In case you need to create custom user roles Profile Builder comes with a built-in Role Editor add-on that can help you with that.
Get started with Profile Builder by clicking the button below:
Profile Builder Pro
The best plugin to restrict WordPress page or content access to logged-in users.Get the plugin
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!
11 thoughts on “Tutorial: WordPress Restrict Page Access to Logged In Users”
your content restriction is super feature.
I have one Problem. Sometimes we must hidden the complete post. Why that? Sometimes the headline tells too much. your content restriction needs this feature, then it is perfect.
Please open a ticket describing this issue: https://www.cozmoslabs.com/support/open-ticket/
I have set all this correctly, but when given a direct URL, a logged out user can access content from the media library. How can i correct this?
Profile Builder is not able to protect direct links that point to content from your Media Gallery.
I have an option to protect options in the media library; what does that do, if not protect from accessing the image?
It protects the WordPress Attachment Page link. This points to a WordPress page with the file.
Gotcha, thanks for clarifying!
The content restriction does not work for me. I installed the plugin and restricted the content of one post to logged in users by checking the boxes in the restrict content section of this post. When I log out I can still view this post.
Is there any settings I did not consider?
Please open a ticket describing this issue: https://www.cozmoslabs.com/support/open-ticket/
Also, a screenshot of your content restriction box will help. On the edit post screen.
We have done this with the Hobbyist version, but the registration form doesn’t seem to be adding the users. There is no email confirmation when that option is selected, and the users don’t appear in the admin panel to approve. Any ideas?
Okay, after spending a week trying other plugins to make the bulk of my website private, I installed Profile Builder and did it in about five minutes. So, I am your newest and greatest fan. I think you have a documentation problem though. You need to explain the difference between Content Restriction and Private Website. I was able to accomplish everything I wanted with Private Website, and Content Restriction is off. But without specific documentation on the difference, I am left wondering if perhaps I need to turn Content Restriction on and individually mark every page as restricted. I hope not because I have well over a hundred pages. Would you please comment on this. Many thanks, for everything.