How To Restrict Access To Areas Of Your WordPress Website

Last Updated on January 17, 2023 by 42 Comments

Editorial Note: We may earn a commission when you visit links on our website.
How To Restrict Access To Areas Of Your WordPress Website
Blog / Tips & Tricks / How To Restrict Access To Areas Of Your WordPress Website
Play Button

Your content is great, and you spend a lot of time creating it. So why in the world would you want to limit access and restrict areas of your WordPress site to only certain folks? Well, lots of reasons, actually. You may host confidential data that may need to be password protected, various documents that you don’t want indexed by search engines, and/or service upgrades and premium content that you sell to make your living. Regardless of the reasoning behind restricting access, there are a couple of ways you can handle doing it.

Subscribe To Our Youtube Channel

Restricting Content

There’s a good chance that you already subscribe or have subscribed to any number of services that restrict content. If you’re an Elegant Themes member, Divi and our plugins are restricted behind your membership credentials. Lynda.com and Team Treehouse, maybe? Or if you support any one on Patreon, there is likely content restricted there.

It may sound harsh, but it’s really not. It’s all a part of the SaaS (software as a service) model.

How Things Usually Work

In general, the flow of a restricted content is the same across the board:

  1. Users visit the website, browse the content offerings, and decide if they want to buy a plan.
  2. They can then click the CTA (probably a big button that says Become a Member or something similar) in the header area or down lower on the squeeze page.
  3. From there, users are generally presented with tiers of plans to select from. They pick one, put in their information, and create an account.
  4. They can then log into that account to get access to the restricted areas of the website where all the stuff they paid for lives.

The beauty of WordPress is that you can do all of this with a few shortcodes or plugins. Some amazing developers out there have created some really nice ways to lock down your site, so setting it all up is about as simple as it can be.

Restricting Access to Your WordPress Site with a Plugin

One of your best options to restrict content is a plugin called MembersNot only is it free, but it allows you to restrict content, admin access, and other capabilities. It also has premium options that make it scale to accommodate more complex projects.

Restrict Access to Your WordPress Website

Upon installation, you will see a new menu option at Settings – Members. There are quite a few options in here, so I’m gonna break it up a little.

Restrict Access to Your WordPress Website

This is the top half of the options screen. Generally, you will leave all of the boxes checked (default) because they give you the largest breadth of actually controlling how you restrict access to your content. However, you do want to make sure to customize the Error Message box — a little personalization goes a long way when you’re telling people no. (Just ask any writer who has ever submitted their writing anywhere.)

This is also a great place to add in a call to action, leading anyone who does not have access to your Become a Member page.

The second half of the options, though, have a few things you will want to consider. The Sidebar Widgets come disabled by default, but it may be a good idea to enable them just to give you the option for more customization.

Restrict Access to Your WordPress WebsiteNow, the Private Site option is a little more complicated. It locks down your entire WordPress installation as being private. This can be good or bad, really. It means they can’t even see a landing page beforehand, so it needs to be done for a reason. Or you may have your member’s content on a secondary WordPress installation.

For example, we have elegantthemes.com as one site, and technically elegantthemes.com/blog is a WordPress installation in a subdirectory. Enabling the private site option for us would mean only the content under /blog would be protected. Not the root URL.

Premium Options

Additionally, you can hit the Add-ons tab to see what premium extensions you can buy to expand the capabilities of the plugin.

Restrict Access to Your WordPress Website

Actually Restricting Your Content

When you get down to it, the reason that Members is such a great plugin is that you have a very simple method of restricting your WordPress content. When you go into any post or page on your site (either new or published), there will be a new metabox under the content called Content Permission.

Restrict Access to Your WordPress Website

All you have to do is assign which user roles on your site get access to the content. Otherwise, they get the restricted message. Additionally, if you need to customize the message they receive on a page-by-page basis, you can do so in the Error Message tab. Otherwise, the message in the plugin options is displayed.

Restrict Access to Your WordPress Website

Do keep in mind that when you use this method, that (depending on your theme, of course) people can still see the meta information, title, and featured image of your post.

Editing Users

Part of Members is that you can edit the users on your site as well. Not only can you restrict the content, but you can also grant or restrict permissions, too under Users – Roles.

Restrict Access to Your WordPress Website

With this, you can set who can view and edit what content on the site. It’s incredibly powerful, and lets you fully control what content anyone can see. By controlling what access people have on the backend, you can effectively restrict even admin content on a granular level.

The Elegant Themes “Protected” Shortcode

Now the Members plugin is one way to do it. If you’re an Elegant Themes member, you can restrict access to any part of your WordPress site with a shortcode. Meet the Protected shortcode. For a quick example, I put a sentence in a blog post inside the shortcodes:

[protected] This content is protected by the Elegant Themes Protected shortcode![/protected]

Nothing too special but more than enough to illustrate the nice feature. Since I am logged in, the content displays on the page when I view it.

Restrict Access to Your WordPress Website

But when a user who is not logged in visits, all they get is the protected version, which displays a prompt for them to log into the site to see whatever is being protected by the shortcode. This is a great feature to use for data, digital goods, or more in which you would like to only give access to certain users, and it comes default in Divi and Extra.

Restrict Access to Your WordPress Website

Conclusion

Granting access to users of your site seems like a daunting process at first. However, the WordPress community makes it pretty simple — like they do most things. Restricting access to your site is great if you need to keep sensitive data private, run a shop that distributes digital goods, or really, doing anything else to make some income online.

Do you currently restrict access to parts of your website? Tells us your ideas and methods in doing so in the comments!

feature image via shutterstock author Best3d

Divi

Want To Build Better WordPress Websites? Start Here! 👇

Take the first step towards a better website.

Get Started
Divi
Premade Layouts

Check Out These Related Posts

Splice Video Editor: An Overview and Review

Splice Video Editor: An Overview and Review

Updated on March 10, 2023 in Tips & Tricks

Video is a valuable form of content for social media. Unfortunately, creating quality videos is usually a long process that involves moving mobile footage to a desktop app for editing. However, mobile editing is on the rise. Apps such as Splice Video Editor make it possible to efficiently create...

View Full Post
How to Use Font Awesome On Your WordPress Website

How to Use Font Awesome On Your WordPress Website

Updated on September 16, 2022 in Tips & Tricks

When given the choice between using a vector icon or a static image, it’s a good idea to go with the vector. They’re small and fast to load, and they can scale to any size without a loss of resolution. Font Awesome is a superb library of vector icons that you can use on your websites,...

View Full Post

42 Comments

  1. can you help me on that.
    i have website, its 42 days program, mean every days from days 0-42 client have certain access to certain page up to 42 days witch now can have entire access….
    how can i do that on wordpress
    mean days 0 … no acces need to buy program, days 1 have just access to page 1 …etc up to 42
    thanks for your help

    • I’d recommend looking for tools that provide a “content drip” feature. I know Sensei has an extension for this. Not sure what other plugins offer it though.

  2. I have some custom roles setup on my site. One example is a role for affiliates. I have some content that I want to restrict to affiliates only. However, the Restrict Content plugin does not support custom roles. That is a deal killer for me. Does anyone know of a plugin that can restrict access and support custom roles?

  3. Hi,

    I implemented the plugin. Everything works perfect except for when the user login, instead of going to the website, it always redirect user back to the profile page.

    Please kindly advise how should I configure it to go to my Homepage on my website instead of WordPress profile page.

    Thanks a lot.

  4. Is there a way to attach a document (i.e.: confidentiality agreement) to the registration, that the person trying to access the page has to sign before viewing the page? Also, would I be able to receive the confidentiality agreement through the email address attached to my WP site?

  5. This restricts the page on post yes but still shows comments, be helpful if it hide comments also

  6. Hi,
    Thank you for this article. Helpful. I have an another question though. The number of 404 errors have increased on my site, http://www.recaptoday.com. When user google recaptoday.com, it shows them pages that are been deleted from the site which results in 404 err. Any suggestions?

  7. I want to give a select group one password (Apple) and have them sign in with their email and (Apple). I don’t want them to register and get an email sent to them. Is there a way to do this?

  8. I need to control access to a wordpress page (not site) to only those being redirected from one source like an aweber responder or a facebook opt-in.

  9. So, where do they go to sign up or register once the message comes up that they cannot access that content? It doesn’t say.

  10. Is there any simpler way to enable access to a single WP page by e.g. providing users with a key (consisting of letters/digits) or a direct access URL? Like in DropBox, you can enable access to a specific folder to users who’ve got the direct URL only. => I’m looking for something very simple which would not require user registration at all.

    Any ideas??

  11. Hi, I am currently trying to create a member section for a charity organisation I volunteer with.

    This post was very helpful but the only problem is the section needs to be for paid members, is there a way that you can do this with this plugin? Or is it a matter of not ticking ‘anyone can register’ and have site admin give out the logins when new members have paid?

  12. So once area’s are protected, how can you make JSON API queries to get at that content. I’m building an IOS app that I want to get info from my wordpress site after protecting area’s (I want to get them to log in with the app and then use the JSON API to query content).

    Thoughts?

  13. I often code myself for this purpose, but this plugin looks promising. I see it’s easy to use. I’ll try it.

    Thanks for sharing.

  14. Super post and plugin, Andy, thanks for this.

    I’m thinking of using this to lock up a learning section on my website – sort of like an online course for learning SEO and other kinds of marketing.

  15. Anybody got a solution on how to use the Protected shortcode with the Divi page builder? Now only the module with the shortcode inside gets protected. I would like to have several modules “locked down”

    • I am also curious how this can work with Divi page builder as well. I can do it on certain builders (with the message appearing each block and not the whole page) but even still I can’t get it to work on the Blog for instance. It would be very helpful to know how to use the quick short code with Divi better. I am a novice at this.

      • would love an answer to this as well!

    • did you ever get an answer to the using the shortcode with the divi page builder? i am curious as well, thanks

  16. This is a great little tutorial! I have many plans to use restrictions on landing pages and squeeze pages.

  17. appeal to writers (sorry)

    You write very useful article but…
    annual subscription ends…
    half a year passes and you write only one template …
    the fact is that it is very good template…
    but the fact is also, this is only one template from the beginning of the year… less words more actions (lines of code)…
    :):):)

    best regards…

  18. What benefits are there to using e.g. wishlist if it can be done like this?

  19. Hi,

    Thanks for the post. I’ll be sure to check out your short code and test it 🙂

    When someone registered is there an easy way to add subscribers to a mail list like Mailchimp?

    Best,
    Michael

  20. Great guideline with great tutorials. Very impressive article, exactly what I needed thanks for share.

  21. A good read Andy has published.
    If only he would be as Pro-Active as Kevin and answer Some questions that have already been posted.
    But if the Comments are only ment to Thank, then thanks :p

  22. I use PMPro (Paid Membership Pro), it’s pretty user friendly and you can restrict access to pages based on membership levels. I also use capability manager to “unrestrict” certain things. For example”contributors” by default could post articles but not upload media to include in their posts, so I added that capability.
    I have yet to find a decent method of hiding the dashboard, not the entire toolbar but just the dashboard icon (I don’t want everyone to know what plugins I have installed or my wordpress version).

    • I’m also using PMPRO but I just found out that a user can only access ONE membership and not multiple ones ? and that the developers are not interested in developing that function at this point, so now I have to look for another (free/cheap) solution that allows access to several memberships… any help would be appreciated!

      • Hi Mimi. Have you looked at Memberpress? It allows for multiple membership levels/products per user. It costs $97/site.

  23. I’ve been using a plugin called Premise for the last few years. Even so, with certain sites, it’s nice to have a solution with smaller “footprint” as a plugin.

  24. Thank you for the very clear post. I want to give access to certain pages only to people who have the link to the page, without their having to register. It looks like this plugin doesn’t allow for that. Do you have a suggestion of a plugin that does?

    • Emlev,

      Only as a thought, but how about simply ‘protecting’ the page from the page/post admin edit.

      Upper right hand corner, where one selects/determines the privacy of a page, and where you can assign a password for same.

      Granted, if a user ‘shares’ that password, the protection is gone, but if you ‘trust’ your users for those particular pages, then
      a) the page would only be known to exist to users having the link
      b) only users with the password could see what was protected on that page
      c) no plugin bloat

      Just a thought.

      Cheers from Southwest Ohio,

      Michael

      • Thank you! That comment was exactly what I was looking for, already utilized it and it works like a charm.

  25. Great tutorial. Is it possible to add extra customization to the elegant themes shortcode? For example, could I use the protected shortcode by user type?

    Or better yet, based on an item they’ve purchased via woocommerce?

  26. Hey ! Exactly what I was thinking about to do today for one of my blogs.
    Thanks. Great infos.

  27. I use Wishlist Member which has a lot of features, but it is a bit not so user friendly.

    Congratulations for the detailed and useful post.

  28. Thanks for this. I set up a membership site in which memberships had to be approved by the site owner. I used WP-Members plugin which has settings to block/unblock page at the page level with a custom field. I also used the “if” menu plugin to hide/show navigation to users depending if they were logged in. Because I set it to block everything automatically, I had to remember to unblock the page where users could reset their password if they’d lost it.

  29. Thanks Andy, this is awesome info! I have a question, do you know how one might restrict access while still showing content in the background? A great example is http://www.dotandbo.com – they present their login and registration in a modal that you have to complete to make go away, but still allow you scroll down the page to see that their is content to be viewed. This is an interesting approach that I am considering – how might one do this in WordPress?

    • I’m also looking to do something like this. Was there a solution found?

  30. I use the premium MemberPress plugin but would like to know if there are any better solutions out there?

    • I’m looking at member press also. Are you still recommending that plugin or have you found a better solution? Thanks!

  31. Yet more information that I didn’t know I needed until I read it. Thanks so much for providing this blog. I LOVE IT!

Leave A Reply

Comments are reviewed and must adhere to our comments policy.

Get Started With Divi