From 770f413fe7d0fcd87e0ab5afae32d1bc3a076f9e Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Tue, 21 Feb 2023 01:49:20 +0000 Subject: [PATCH] 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 --- wp-includes/class-wp-http.php | 5 +++++ wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/wp-includes/class-wp-http.php b/wp-includes/class-wp-http.php index 6f4fa47200..12a56b0a0a 100644 --- a/wp-includes/class-wp-http.php +++ b/wp-includes/class-wp-http.php @@ -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, '/' ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index da791970f4..8bb891690c 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.