Changeset 54364
- Timestamp:
- 10/01/2022 03:23:41 AM (2 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rewrite.php
r53857 r54364 501 501 $url = apply_filters( 'url_to_postid', $url ); 502 502 503 $url_host = str_replace( 'www.', '', parse_url( $url, PHP_URL_HOST ) ); 504 $home_url_host = str_replace( 'www.', '', parse_url( home_url(), PHP_URL_HOST ) ); 503 $url_host = parse_url( $url, PHP_URL_HOST ); 504 505 if ( is_string( $url_host ) ) { 506 $url_host = str_replace( 'www.', '', $url_host ); 507 } else { 508 $url_host = ''; 509 } 510 511 $home_url_host = parse_url( home_url(), PHP_URL_HOST ); 512 513 if ( is_string( $home_url_host ) ) { 514 $home_url_host = str_replace( 'www.', '', $home_url_host ); 515 } else { 516 $home_url_host = ''; 517 } 505 518 506 519 // Bail early if the URL does not belong to this site. -
trunk/tests/phpunit/tests/rewrite.php
r53942 r54364 256 256 } 257 257 258 public function test_url_to_postid_home_has_path() { 259 258 /** 259 * @covers ::url_to_postid 260 */ 261 public function test_url_to_postid_url_has_only_path() { 262 $this->assertSame( 0, url_to_postid( '/example/' ) ); 263 } 264 265 /** 266 * @covers ::url_to_postid 267 */ 268 public function test_url_to_postid_home_has_only_path() { 260 269 update_option( 'home', home_url( '/example/' ) ); 261 270
Note: See TracChangeset
for help on using the changeset viewer.