Redirect to a page based on a restricted pages ccap

if someone tries to visit a restricted page they are redirected to a signup page.

i would like to have a different page depending on the ccap restriction of they page they try and visit.


  1. members only content page - restricted to level 1 with ccap premiumyear - redirect to membership signup page

2, members only content page - restricted to level 1 with ccap coachingprogram- redirect to coaching programme sales page

Is this possible?

Yes. See: WP Admin > s2Member > API / Scripting > Membership Options Page Variables

Then see:

Or you can leave the page accessible and instead change its content based on the user’s access using conditionals. That way if the person doesn’t have the access you offer it to him, and if he does you show him the content.

I hope that helps. :slight_smile:

Arrh, I think that helps, but it is a bit above my level. I think the “if” then “else” might help, but I am not really sure how to implement. I just want to do the following. Place some type of code/redirection on all my protected course pages that direct anyone who lands there to that courses specific sales page.

Then you could try the redirection hack I linked to, but make the redirection dynamic using the ccap as the page’s slug.

Create this directory and file: /wp-content/mu-plugins/s2-mop-ccap-redir.php

add_action('template_redirect', function () {
    if (empty($_REQUEST['_s2member_vars'])) {
        return; // Nothing to do here.
        return; // Nothing to do here.
    @list($restriction_type, $requirement_type, $requirement_type_value, $seeking_type, $seeking_type_value, $seeking_uri)
        = explode('..', stripslashes((string) $_REQUEST['_s2member_vars']));

    if (!empty($requirement_type) && $requirement_type === 'ccap') {
        if (!empty($requirement_type_value) && $requirement_type_value === 'pro') {

Then you need a page for each ccap, or you’ll get 404s. So if the ccap is “videos” you need a page at

I hope that helps. :slight_smile: