Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ipokkel/1bae6b97303f2c2e0ae3afde160ad455 to your computer and use it in GitHub Desktop.
Save ipokkel/1bae6b97303f2c2e0ae3afde160ad455 to your computer and use it in GitHub Desktop.
Redirect users away from 'account' page in PMPro if they do not have a membership/logged-in #pmpro #account #redirect #slug
<?php
/**
* Redirect user's to a new URL instead of the 'levels' page in PMPro.
* Add this code to your PMPro Customizations plugin - http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function redirect_users_to_a_new_page( $url ){
return home_url('my-landing-page-slug'); //change this to the page slug you would like to redirect your user's to.
}
//redirect if users do not have membership level.
add_filter( 'pmpro_account_preheader_redirect', 'redirect_users_to_a_new_page' );
//redirect users if they not logged in at all.
add_filter( 'pmpro_account_preheader_no_user_redirect', 'redirect_users_to_a_new_page' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment