It’s more complex than it seems, I managed to create a php script to alter these urls however the problem is that if you’re already logged in to the target multisite, trying to send to the custom link will return 404. When you’re not logged in, it should send to the custom url and if not, it should link to the custom URL. Tricky.
<?php
if ( ! defined('CUSTOM_ADMIN_SLUG') ) {
define('CUSTOM_ADMIN_SLUG', 'dashboard-login/');
}
/**
* Build the custom admin base for a given site.
*/
function gi_custom_admin_base($blog_id = null) {
$site_url = $blog_id ? get_site_url($blog_id, '/') : site_url('/');
return trailingslashit($site_url) . trailingslashit(untrailingslashit(CUSTOM_ADMIN_SLUG));
}
/**
* Core filter to rewrite admin URLs.
*/
function gi_filter_admin_url($url, $path, $blog_id) {
if (gi_skip_admin_rewrite((string)$path)) {
return $url; // leave core endpoints intact
}
$from = '/wp-admin/';
$to = '/' . trailingslashit(untrailingslashit(CUSTOM_ADMIN_SLUG));
if (! empty($path)) {
$url = gi_custom_admin_base($blog_id) . ltrim($path, '/');
} else {
$url = str_replace($from, $to, $url);
if (strpos($url, $to) === false) {
$url = gi_custom_admin_base($blog_id);
}
}
return $url;
}
add_filter('admin_url', 'gi_filter_admin_url', 99, 3);
Hi,
Thanks for using WPS Hide Login.
Our plugin is only used to customize the login URL.
It doesn’t change the WordPress admin URL.
Regards.