Last active
June 11, 2020 20:15
-
-
Save andrewlimaza/bb1150acaf01ecd4f7b351488665cec4 to your computer and use it in GitHub Desktop.
redirect members away from a specific page for PMPro.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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_members() { | |
if ( is_page('join') && pmpro_hasMembershipLevel() ) { | |
wp_redirect(home_url( '/my-page-slug' ) ); | |
exit; | |
} | |
} | |
add_action('template_redirect', 'my_template_redirect_members'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment