From d3d9374e06d8fbd8035be02e3bc87c47fa99503a Mon Sep 17 00:00:00 2001 From: audrasjb Date: Mon, 12 Feb 2024 15:26:10 +0000 Subject: [PATCH] Canonical: Introduce `admin_canonical_url` filter. This changeset introduces the new `admin_canonical_url` hook to help developers and extenders to modify the admin canonical url value. Props prionkor, audrasjb. Fixes #59545. Built from https://develop.svn.wordpress.org/trunk@57595 git-svn-id: http://core.svn.wordpress.org/trunk@57096 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/misc.php | 9 +++++++++ wp-includes/version.php | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/misc.php b/wp-admin/includes/misc.php index ad3796fea3..2a07061796 100644 --- a/wp-admin/includes/misc.php +++ b/wp-admin/includes/misc.php @@ -1396,6 +1396,15 @@ function wp_admin_canonical_url() { // Ensure we're using an absolute URL. $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); $filtered_url = remove_query_arg( $removable_query_args, $current_url ); + + /** + * Filters the admin canonical url value. + * + * @since 6.5.0 + * + * @param string $filtered_url The admin canonical url value. + */ + $filtered_url = apply_filters( 'admin_canonical_url', $filtered_url ); ?>