Multisite: Introduce a self_admin_url filter to adjust the URL to an administration panel.

Props j.hoffmann.
Fixes #37446.


git-svn-id: https://develop.svn.wordpress.org/trunk@41060 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Felix Arntz
2017-07-14 23:00:55 +00:00
parent c8e811cc7e
commit 55bb567e0f
2 changed files with 74 additions and 6 deletions
+18 -6
View File
@@ -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 );
}
/**