WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

wp_redirect_admin_locations() WP 3.4.0

Redirects a variety of shorthand URLs to the admin.

If a user visits example.com/admin, they'll be redirected to /wp-admin. Visiting /login redirects to /wp-login.php, and so on.

Хуков нет.

Возвращает

Null. Ничего.

Использование

wp_redirect_admin_locations();

Заметки

  • Global. WP_Rewrite. $wp_rewrite WordPress rewrite component.

Список изменений

С версии 3.4.0 Введена.

Код wp redirect admin locations: wp-includes/canonical.php WP 5.3.1

<?php
function wp_redirect_admin_locations() {
	global $wp_rewrite;
	if ( ! ( is_404() && $wp_rewrite->using_permalinks() ) ) {
		return;
	}

	$admins = array(
		home_url( 'wp-admin', 'relative' ),
		home_url( 'dashboard', 'relative' ),
		home_url( 'admin', 'relative' ),
		site_url( 'dashboard', 'relative' ),
		site_url( 'admin', 'relative' ),
	);
	if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $admins ) ) {
		wp_redirect( admin_url() );
		exit;
	}

	$logins = array(
		home_url( 'wp-login.php', 'relative' ),
		home_url( 'login', 'relative' ),
		site_url( 'login', 'relative' ),
	);
	if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $logins ) ) {
		wp_redirect( wp_login_url() );
		exit;
	}
}