HTTP API: Add fragment support to `WP_Http::make_absolute_url()`.

Modifies `WP_Http::make_absolute_url()` to prevent it from dropping URL fragments, this in turn fixes the same issue for `links_add_base_url()`.

Props costdev, sergeybiryukov, dshanske, schlessera, jrf, desrosj, dd32.
Fixes #56231.


Built from https://develop.svn.wordpress.org/trunk@55370


git-svn-id: http://core.svn.wordpress.org/trunk@54903 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Wilson 2023-02-21 01:49:20 +00:00
parent a77704f1a3
commit 770f413fe7
2 changed files with 6 additions and 1 deletions

View File

@ -1013,6 +1013,11 @@ class WP_Http {
$path .= '?' . $relative_url_parts['query'];
}
// Add the fragment.
if ( ! empty( $relative_url_parts['fragment'] ) ) {
$path .= '#' . $relative_url_parts['fragment'];
}
return $absolute_path . '/' . ltrim( $path, '/' );
}

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.2-beta2-55369';
$wp_version = '6.2-beta2-55370';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.