Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Created July 4, 2017 14:49
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save andrewlimaza/0f3fb8c74083ce8528f5a755a01a8004 to your computer and use it in GitHub Desktop.
Save andrewlimaza/0f3fb8c74083ce8528f5a755a01a8004 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
<?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 'https://some-url.com'; //change this to the URL 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