Created
March 18, 2024 13:48
-
-
Save andrewlimaza/c573c744388096dff12351e2e79a3e20 to your computer and use it in GitHub Desktop.
Redirect logged-in people away from the login page of 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 | |
/** | |
* Redirect logged-in users away from the login page if already logged-in. | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_login_page_redirect() { | |
global $pmpro_pages; | |
if ( is_page( $pmpro_pages['login'] ) && is_user_logged_in() ) { | |
wp_redirect( home_url( '/page-slug/' ) ); | |
exit; | |
} | |
} | |
add_action( 'template_redirect', 'my_pmpro_login_page_redirect' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment