Redirect to the Membership Account Page after Email Confirmation

If you’re using the Email Confirmation Add On to validate member email addresses, this code recipe will set up a redirect to the Membership Account page when a member clicks the validation link.

This page requires a PMPro Core Account or higher.

Already have an account? Login Now »

New to this site? Register Now »

Restrict Access by Membership Level for Custom Post Type (CPT) Categories

The code recipe below sets membership restriction on a Custom Post Type (CPT) category. When a non-member visits a CPT in a protected category (either a logged out visitor or a logged in user without membership access) they will be redirected to the membership levels page (or another page as defined in your custom function).


How it Works

You can update the code recipe with appropriate membership levels to check, the CPT categories you want to redirect, and the page that the non-member gets redirected to. You can even duplicate the recipe to account for multiple CPT category and level/redirect page relationships.

pmpro_cpt-events-demoLets say, for example, you are using an events plugin. You could set a category of event for “Members Only”, then use this recipe to redirect non-members to a sales page for membership to join these events.

Or, you may be using a directory plugin that you list special partner offers for members only. You could set a category of these “premium offer” listings that require membership.


Just want to restrict single CPTs?

If you want to restrict your Custom Post Type at the singular level, use the Custom Post Type Membership Access add on.


The Code Recipe

This code recipe requires a PMPro Plus Account or higher.

View Membership Options

Redirect Away from Checkout if User Doesn’t Meet Membership Requirements

We’ve blogged previously about requiring a specific level to allow registration for another level. In that post, the registration check occurs after the user submits the checkout form. This new code gist immediately redirects away from the checkout page if the user’s current membership level is not ID = 1 or is unset.

Again… why would I want to do this?

As I said in the previous post, some membership sites have a specific workflow for membership. For example, if you have a fitness website with phases of training, you’d want to make sure your customers move through your program in the right order.

This page requires a PMPro Core Account or higher.

Already have an account? Login Now »

New to this site? Register Now »

New Add On to Auto-Detect, Protect and Redirect Custom Post Types

The Custom Post Type Membership Access Add On adds the ‘Require Membership’ meta box to all CPTs selected and redirects non-members to the selected page.

View the Add On


Select the CPTs to Restrict

The add on’s settings page detects the Custom Post Types (CPTs) active in your WordPress. You can select the CPTs to add the ‘Require Membership’ meta box to. Then on that single edit screen for the CPT select membership levels with access.

It even works with WooCommerce for “members only” products (redirects users without access from the single product view).


Then, redirect the single CPT frontend view to a selected page.

In most cases, your theme has set up CPTs to display content on the frontend in a unique way. For this reason, the standard ways that Paid Memberships Pro filters membership content will not cover all cases. Thus, the add on will simply redirect users without access to a selected page.

Most sites will want to redirect to the “membership levels” page – but you can choose any page you’d like in the drop down under Settings > PMPro CPTs.


Installation

  1. Upload ‘pmpro-cpt’ to the ‘/wp-content/plugins/’ directory.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress.
  3. Navigate to Settings > PMPro CPTs in the WordPress Admin to select custom post types and set redirection rules.

Screenshot

pmpro-cpt


Notes

This redirection will also apply to a search engine indexing your site.

Setting membership access restrictions for a single CPT will not necessarily hide it from archives, search, or other custom templates built into your theme.