diff --git bp-core/bp-core-catchuri.php bp-core/bp-core-catchuri.php
index ed159be..c87dfd1 100644
|
|
|
function bp_get_canonical_url( $args = array() ) {
|
| 621 | 621 | $r = wp_parse_args( $args, $defaults ); |
| 622 | 622 | extract( $r ); |
| 623 | 623 | |
| | 624 | // Special case: when a BuddyPress directory is set to be the front |
| | 625 | // page, ensure that requests for that directory at the normal URL |
| | 626 | // are redirected to the home page. |
| | 627 | if ( 'page' == get_option( 'show_on_front' ) && $page_on_front = (int) get_option( 'page_on_front' ) ) { |
| | 628 | $front_page_component = array_search( $page_on_front, bp_core_get_directory_page_ids() ); |
| | 629 | |
| | 630 | // If requesting the front page component directory, send to |
| | 631 | // the front page instead |
| | 632 | if ( false !== $front_page_component && is_page( $page_on_front ) ) { |
| | 633 | $bp->canonical_stack['canonical_url'] = trailingslashit( bp_get_root_domain() ); |
| | 634 | |
| | 635 | // Unless the front page is set to the registration page and |
| | 636 | // the current user is logged in, in which case we send to the |
| | 637 | // members directory to avoid redirect loops |
| | 638 | } else if ( bp_is_register_page() && 'register' == $front_page_component && is_user_logged_in() ) { |
| | 639 | $bp->canonical_stack['canonical_url'] = apply_filters( 'bp_loggedin_register_page_redirect_to', trailingslashit( bp_get_root_domain() . '/' . bp_get_members_root_slug() ) ); |
| | 640 | } |
| | 641 | } |
| | 642 | |
| 624 | 643 | if ( empty( $bp->canonical_stack['canonical_url'] ) ) { |
| 625 | 644 | // Build the URL in the address bar |
| 626 | 645 | $requested_url = bp_get_requested_url(); |