From 6625f0c5515bc077323ad59e443faaa79812425d Mon Sep 17 00:00:00 2001 From: Felix Arntz Date: Fri, 14 Jul 2017 23:01:42 +0000 Subject: [PATCH] Multisite: Introduce a `self_admin_url` filter to adjust the URL to an administration panel. Props j.hoffmann. Fixes #37446. Built from https://develop.svn.wordpress.org/trunk@41060 git-svn-id: http://core.svn.wordpress.org/trunk@40910 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/link-template.php | 24 ++++++++++++++++++------ wp-includes/version.php | 2 +- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 4d3a37ca5d..9f8cb01e75 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -3397,12 +3397,24 @@ function user_admin_url( $path = '', $scheme = 'admin' ) { * @return string Admin URL link with optional path appended. */ function self_admin_url( $path = '', $scheme = 'admin' ) { - if ( is_network_admin() ) - return network_admin_url($path, $scheme); - elseif ( is_user_admin() ) - return user_admin_url($path, $scheme); - else - return admin_url($path, $scheme); + if ( is_network_admin() ) { + $url = network_admin_url( $path, $scheme ); + } elseif ( is_user_admin() ) { + $url = user_admin_url( $path, $scheme ); + } else { + $url = admin_url( $path, $scheme ); + } + + /** + * Filters the admin URL for the current site or network depending on context. + * + * @since 4.9.0 + * + * @param string $url The complete URL including scheme and path. + * @param string $path Path relative to the URL. Blank string if no path is specified. + * @param string $scheme The scheme to use. + */ + return apply_filters( 'self_admin_url', $url, $path, $scheme ); } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 8a5376bb44..500b7a3187 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9-alpha-41059'; +$wp_version = '4.9-alpha-41060'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.