Tutorial: WordPress Restrict Page Access to Logged In Users

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 at 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 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 WordPress Restrict Page Access to Logged In Users Plugin

The Profile Builder WordPress plugin 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 frontend 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 restrictions 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.

Get Profile Builder

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

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 Profile Builder menu tab, navigate to General Settings and make sure you enable Content Restriction.

Enable WordPress Restrict Page Access to Logged In Users functionality

2. Set up Custom Restriction Messages

After activating the restrict content feature, you’ll notice a new submenu item appearing under Profile Builder tab, named Content Restriction.

From here, you’ll be able to 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 backend are simple and easy to configure.

WordPress Restrict Page Access to Logged In Users message

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:

Example of WordPress Restrict Page Access to Logged In Users functionality

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 login to their account or register for an account to view the exclusive content. With Profile Builder Pro, you can do this using the [[wppb-login]] or [[wppb-register]] shortcode.

3. Set Up Content Restriction Rules

After setting up the restriction messages, in your WP 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 metabox called “Profile Builder Content Restriction“.

Here, you can set up both WordPress restrict page access to logged in users functionality and WordPress restrict content 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.

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.

Restricting access to user roles or by logged in status

Also, if you want to send your users to another page (for example the homepage), you can enable the redirect feature. Inside our post, we will redirect all of the users that don’t have the following roles assigned: Editor, Subscriber, SEO Manager or SEO Editor.

Creating a custom redirect URL

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.

Conclusions

With the Profile Builder WordPress plugin, it’s easy to set up WordPress restrict page access to logged in users functionality for any logged in user or just certain users with specific user roles.

You can use it in multiple scenarios, from providing members-only content, to restricting access to personal or confidential data, or simply setting a WooCommerce store available 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 form (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]] shortcode.

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:

Get Profile Builder

And if you want even more flexibility to create private content and premium content at 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.

Get Paid Member Subscriptions

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!

10 thoughts on “Tutorial: WordPress Restrict Page Access to Logged In Users

  1. 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.

  2. 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?

    1. Hello,

      Profile Builder is not able to protect direct links that point to content from your Media Gallery.

      Regards.

      1. I have an option to protect options in the media library; what does that do, if not protect from accessing the image?

        1. It protects the WordPress Attachment Page link. This points to a WordPress page with the file.

  3. 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?

  4. 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?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.