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
This commit is contained in:
audrasjb 2024-02-12 15:26:10 +00:00
parent c193c9936b
commit d3d9374e06
2 changed files with 10 additions and 1 deletions

View File

@ -1396,6 +1396,15 @@ function wp_admin_canonical_url() {
// Ensure we're using an absolute URL. // Ensure we're using an absolute URL.
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
$filtered_url = remove_query_arg( $removable_query_args, $current_url ); $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 );
?> ?>
<link id="wp-admin-canonical" rel="canonical" href="<?php echo esc_url( $filtered_url ); ?>" /> <link id="wp-admin-canonical" rel="canonical" href="<?php echo esc_url( $filtered_url ); ?>" />
<script> <script>

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.5-alpha-57594'; $wp_version = '6.5-alpha-57595';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.