diff --git bp-core/bp-core-catchuri.php bp-core/bp-core-catchuri.php
index bb052a1..518f86a 100644
|
|
function bp_core_load_template( $templates ) { |
367 | 367 | $wp_query->queried_object_id = $object_id; |
368 | 368 | $post = $wp_query->queried_object; |
369 | 369 | } |
370 | | |
| 370 | |
371 | 371 | // Define local variables |
372 | 372 | $located_template = false; |
373 | 373 | $filtered_templates = array(); |
… |
… |
function bp_core_load_template( $templates ) { |
385 | 385 | $wp_query->is_page = $wp_query->is_singular = true; |
386 | 386 | $wp_query->is_404 = false; |
387 | 387 | |
| 388 | do_action( 'bp_core_pre_load_template', $located_template ); |
| 389 | |
388 | 390 | load_template( apply_filters( 'bp_load_template', $located_template ) ); |
| 391 | |
| 392 | do_action( 'bp_core_post_load_template', $located_template ); |
389 | 393 | } |
390 | 394 | |
391 | 395 | // Kill any other output after this. |
diff --git bp-core/bp-core-functions.php bp-core/bp-core-functions.php
index 76576a0..1e5f5f9 100644
|
|
function bp_do_404( $redirect = 'remove_canonical_direct' ) { |
1524 | 1524 | if ( 'remove_canonical_direct' == $redirect ) |
1525 | 1525 | remove_action( 'template_redirect', 'redirect_canonical' ); |
1526 | 1526 | } |
| 1527 | |
| 1528 | /** |
| 1529 | * Canonicalizes URLs by ensuring that requests are always redirected to a trailingslashed version |
| 1530 | * |
| 1531 | * @since 1.6 |
| 1532 | */ |
| 1533 | function bp_redirect_canonical() { |
| 1534 | if ( !bp_is_blog_page() && apply_filters( 'bp_do_redirect_canonical', true ) ) { |
| 1535 | // build the URL in the address bar |
| 1536 | $requested_url = is_ssl() ? 'https://' : 'http://'; |
| 1537 | $requested_url .= $_SERVER['HTTP_HOST']; |
| 1538 | $requested_url .= $_SERVER['REQUEST_URI']; |
| 1539 | |
| 1540 | // Stash query args |
| 1541 | $url_stack = explode( '?', $requested_url ); |
| 1542 | $url_base = $url_stack[0]; |
| 1543 | $url_stack[0] = trailingslashit( $url_stack[0] ); |
| 1544 | |
| 1545 | if ( $url_stack[0] !== $url_base ) { |
| 1546 | bp_core_redirect( implode( '?', $url_stack ) ); |
| 1547 | } |
| 1548 | } |
| 1549 | } |
| 1550 | add_action( 'bp_core_pre_load_template', 'bp_redirect_canonical' ); |
1527 | 1551 | ?> |