Created
April 12, 2018 17:32
-
-
Save kimcoleman/e975b392e05610c6ff563e58b0ddc019 to your computer and use it in GitHub Desktop.
Redirect the Membership Account page to the user's BuddyPress Profile.
This file contains hidden or 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 the Membership Account page to the user's BuddyPress Profile. | |
* | |
*/ | |
function my_pmpro_buddypress_profile_template_redirect() { | |
global $pmpro_pages; | |
// Make sure PMPro is active. | |
if ( empty( $pmpro_pages ) ) { | |
return; | |
} | |
// Make sure BuddyPress is active. | |
if ( ! function_exists( 'bp_loggedin_user_domain' ) ) { | |
return; | |
} | |
// Redirect the Membership Account page to the bbPress User Profile. | |
if ( is_page( $pmpro_pages['account'] ) ) { | |
wp_redirect( bp_loggedin_user_domain() ); | |
exit; | |
} | |
} | |
add_action( 'template_redirect', 'my_pmpro_buddypress_profile_template_redirect' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment