Forked from andrewlimaza/redirect_users_to_a_new_page.php
Last active
April 3, 2021 03:11
-
-
Save kimcoleman/33a2e2dd6dfe908d5a8f5714ad150bd2 to your computer and use it in GitHub Desktop.
Redirect non-members to the Membership Levels page in PMPro if they do not have a membership level.
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 | |
/** | |
* Redirect non-members to the Membership Levels page if they do not have a membership level. | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* | |
*/ | |
function redirect_non_members_to_levels_page( $url ) { | |
$url = pmpro_url( 'levels' ); | |
return $url; | |
} | |
add_filter( 'pmpro_account_preheader_redirect', 'redirect_non_members_to_levels_page' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This recipe is included in the blog post on "Redirect Non-Members Away From the Membership Account Page" at Paid Memberships Pro here: https://www.paidmembershipspro.com/redirect-non-members-from-membership-account/