Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kimcoleman/e975b392e05610c6ff563e58b0ddc019 to your computer and use it in GitHub Desktop.
Save kimcoleman/e975b392e05610c6ff563e58b0ddc019 to your computer and use it in GitHub Desktop.
Redirect the Membership Account page to the user's BuddyPress Profile.
<?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