Table of Contents
If you run a community site that 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.
This is where Profile Builder comes in. This tool offers a WordPress restrict page access to logged-in users functionality. However, it’s a complete user management so you can also use it to customize registration and login forms, create user listings, and more.
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. Let’s dive right in!
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.
Profile Builder Pro
Create beautiful front-end registration and profile forms with custom fields. Setup member directories, custom redirects, cutomize user emails & more using the all in one user management plugin.
Get Profile BuilderWith 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.
Plus, 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 enables you to create custom user roles. You can create as many roles as needed to properly limit access to your WordPress content.
WordPress Restrict Page Access to Logged-in Users Tutorial
Now, let’s look at how to restrict page access to logged-in users in WordPress, in three easy steps.
1. Enable Content Restriction Feature in Profile Builder
To get started, you’ll need 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, in your WordPress dashboard, navigate to Profile Builder → Settings and click on the Content Restriction:
Here, you’ll see a toggle switch for activating content restriction. Turn it on and move on to the next step.
2. Set Up Custom Restriction Messages
In the same tab, you set up the type of restriction, such as Message or Redirect. If you choose the latter, you’ll need to enter the redirect URL:
You also have the option to display a portion of the restricted content to logged-out users.
If you choose to display a message instead, you can customize this using the fields provided:
For example, here’s what a user might see when they try to view content that they don’t have access to:
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 Register and Login blocks in the Block Editor:
Alternatively, you can do this using the [[wppb-login]] for custom login forms, or [[wppb-register]] shortcode for custom registration forms. In either case, you’re free to place these forms anywhere you want on your website and they will function just the same.
3. Set Up Content Restriction Rules
After setting up the restriction messages, 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.
Furthermore, if you want to customize the restriction message for this specific page or post, toggle the switch for Enable Custom Messages:
Also, if you want to send your users to another page (for example the homepage), you can enable the Redirect feature within the Display Options meta box.
For example, you might redirect all users who aren’t editors, authors, subscribers, or administrators to a URL of your choosing:
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.
Conclusion
With Profile Builder, it’s easy to restrict page access to logged-in users or individuals with specific user roles. You can use this feature to provide members-only content, restrict access to personal or confidential data, or set a WooCommerce store to only be available to members.
This also encourages users who don’t already have an account to create one. You can simply add a login or registration form to the sidebar widget or anywhere on your site, using the blocks that are included with the plugin. And in case you need to create custom user roles, Profile Builder comes with a built-in Role Editor add-on.
If you want even more flexibility to create private and premium content on your membership site, you might benefit from a full WordPress membership plugin like Paid Member Subscriptions.
Paid Member Subscriptions Pro
Accept (recurring) payments, create subscription plans and restrict content on your website. Easily setup a WordPress membership site using Paid Member Subscriptions.
Get Paid Member SubscriptionsThis plugin builds on the content restriction functionality in Profile Builder and lets you sell access to your content on a one-time or recurring basis.
Do you have any questions about the WordPress restrict page access to logged-in users feature? Let us know in the comments section below!
Related Articles
How to Customize the WooCommerce Login Page (No Code Needed)
Searching for a solution to customize the WooCommerce login page and otherwise control login behavior on your WooCommerce store? If you allow (or force) registration on your store, you'll want to create a user-friendly login experience so that your shoppers can easily log in to their accounts and access other key features. In this post, […]
Continue Reading8 Best WordPress User Registration Plugins
Not sure what WordPress user registration plugin to use for your project? Going through all the WordPress user registration plugins can be disorienting. You may have spent hours and hours searching for plugins and tutorials to help you with your project, and you’re still as confused as you were when you started. Imagine finding the […]
Continue ReadingHow to Customize WordPress Email Login Behavior (+ Registration)
Searching for a WordPress email login feature so that you can customize your site's login process, such as requiring users to use their email address instead of a username? By default, WordPress lets users log in with either their username and password or their email and password via the default login page. But if you […]
Continue Reading
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.
Hello Karl,
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?
Hello,
Profile Builder is not able to protect direct links that point to content from your Media Gallery.
Regards.
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!
Hello,
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?
Hello Julian,
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.