Changeset 35770
- Timestamp:
- 12/04/2015 11:10:09 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/canonical.php
r35480 r35770 490 490 491 491 // yes, again -- in case the filter aborted the request 492 if ( ! $redirect_url || $redirect_url == $requested_url) {492 if ( ! $redirect_url || strip_fragment_from_url( $redirect_url ) == strip_fragment_from_url( $requested_url ) ) { 493 493 return; 494 494 } … … 536 536 537 537 /** 538 * Strips the #fragment from a URL, if one is present. 539 * 540 * @since 4.4.0 541 * 542 * @param string $url The URL to strip. 543 * @return string The altered URL. 544 */ 545 function strip_fragment_from_url( $url ) { 546 $parsed_url = @parse_url( $url ); 547 if ( ! empty( $parsed_url['host'] ) ) { 548 // This mirrors code in redirect_canonical(). It does not handle every case. 549 $url = $parsed_url['scheme'] . '://' . $parsed_url['host']; 550 if ( ! empty( $parsed_url['port'] ) ) { 551 $url .= ':' . $parsed_url['port']; 552 } 553 $url .= $parsed_url['path']; 554 if ( ! empty( $parsed_url['query'] ) ) { 555 $url .= '?' . $parsed_url['query']; 556 } 557 } 558 559 return $url; 560 } 561 562 /** 538 563 * Attempts to guess the correct URL based on query vars 539 564 *
Note: See TracChangeset
for help on using the changeset viewer.