Membership plugins are designed to help your site restrict content, accept subscription payments, manage member profile information and more. But is a plugin always the right solution?

A very simple membership site may not actually require a membership plugin. This article will show you how to restrict your entire WordPress site for logged in users only.

you dont need a membership plugin

Which sites don’t need a membership plugin?

While countless more models could make use of this method, here are a few of the types of sites that may not need a complete membership platform:

  • Basic membership sites that want to collect email addresses for free access to website content.
  • Restricted sites where the user account must be created by the admin.
  • Corporate Intranets that need to communicate a variety of information to the team.
  • Local community groups that share conversations online in a forum or via articles and comments.
  • Membership sites that are “just getting started” and do not need the complexity of a membership plugin, yet.

Does your site fits one of these models or have similar characteristics? If the answer is “yes” or even “kind of”—keep reading.


Can I add a membership plugin later?

Yes. The beauty of this method is that you own all of your member data, register users as “users” in WordPress, and already have a working WordPress site that you are comfortable working in.

If you decide to expand your membership offering and charge for access, you can. I would only recommend that you select an open source, WordPress-friendly membership plugin like PMPro or others. These plugins are designed to leverage your existing user database that powers your “starter” membership site. We have recipes that bulk update membership data for the entire User list and have helped site owners with customizations to grandfather existing users into special membership pricing, provide existing users a unique “founding member” status, and more.


Let’s get to the code recipe.

The recipe below has a few key sections that you may or may not use depending on how your simple membership site is structured. You’ll need to decide what portion of your site is “public” and what portion of your site is “restricted”. Visitors also need access to a few key pages including the login, password reset, and logout page. Any visitor attempting to access a restricted page will be redirected to your login page.

Yes, this method requires editing a little bit of code. But a little bit of code is worth it to keep things lightweight if your site fits this model.


The Code Recipe


Adding the recipe to your website

Copy and paste this code recipe into a custom plugin or use the Code Snippets plugin available for free in the WordPress repository.

The recipe includes several sections that may or may not apply to your project. Comments within the code should explain what each portion is doing. You can remove or comment out any portion of the recipe that is not applicable. For example, we have included the default page slugs that the Theme My Login plugin generates for the frontend login process enabled by their plugin. If you are not using this plugin, you can remove this section of the recipe.

The $okay_pages array specifies any other page that visitors are allowed to access. The array accepts either a page slug or ID. You can update this to recognize the public pages for your site, or remove it if you do not want to offer anything.

This recipe is designed to allow public access to your site’s homepage, whether your page is set to display your latest posts or a static page. You can remove that portion of the recipe to restrict access to your site’s homepage.

Cover image from ebook 29 Nuggets of Wisdom Volume 1 - Sample Collection

Download the free ebook: Get 29 insights and ‘aha moments’ for new or veteran membership site business owners. Use these nuggets of wisdom to inspire or challenge you.

Was this article helpful?
YesNo