Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Last active June 11, 2020 20:15
Show Gist options
  • Select an option

  • Save andrewlimaza/bb1150acaf01ecd4f7b351488665cec4 to your computer and use it in GitHub Desktop.

Select an option

Save andrewlimaza/bb1150acaf01ecd4f7b351488665cec4 to your computer and use it in GitHub Desktop.

Revisions

  1. andrewlimaza revised this gist Nov 15, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions redirect-members-from-page-pmpro.php
    Original file line number Diff line number Diff line change
    @@ -3,10 +3,10 @@
    * This will redirect members from Page A to Page B. Non-members will be able to access Page A.
    * Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
    */
    function my_template_redirect_require_membership_access() {
    function my_template_redirect_members() {
    if ( is_page('join') && pmpro_hasMembershipLevel() ) {
    wp_redirect(home_url( '/my-page-slug' ) );
    exit;
    }
    }
    add_action('template_redirect', 'my_template_redirect_require_membership_access');
    add_action('template_redirect', 'my_template_redirect_members');
  2. andrewlimaza created this gist Nov 15, 2018.
    12 changes: 12 additions & 0 deletions redirect-members-from-page-pmpro.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    <?php
    /**
    * This will redirect members from Page A to Page B. Non-members will be able to access Page A.
    * Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
    */
    function my_template_redirect_require_membership_access() {
    if ( is_page('join') && pmpro_hasMembershipLevel() ) {
    wp_redirect(home_url( '/my-page-slug' ) );
    exit;
    }
    }
    add_action('template_redirect', 'my_template_redirect_require_membership_access');