wpmu_admin_do_redirect() - WordPress 函数参考中文文档

返回介绍

wpmu_admin_do_redirect()

发布于 2017-09-11 字数2243 浏览 826 评论 0

Warning: This function has been deprecated. Use wp_redirect() instead.

wpmu_admin_do_redirect( string $url = '' )

Redirect a user based on $_GET or $_POST arguments.


描述

The function looks for redirect arguments in the following order: 1) $_GET[‘ref’] 2) $_POST[‘ref’] 3) $_SERVER[‘HTTP_REFERER’] 4) $_GET[‘redirect’] 5) $_POST[‘redirect’] 6) $url


参数

$url

(string)
(Optional)
Redirect URL.

Default value: ”


源代码

File: wp-includes/ms-deprecated.php

function wpmu_admin_do_redirect( $url = '' ) {
	_deprecated_function( __FUNCTION__, '3.3.0' );

	$ref = '';
	if ( isset( $_GET['ref'] ) )
		$ref = $_GET['ref'];
	if ( isset( $_POST['ref'] ) )
		$ref = $_POST['ref'];

	if ( $ref ) {
		$ref = wpmu_admin_redirect_add_updated_param( $ref );
		wp_redirect( $ref );
		exit();
	}
	if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) {
		wp_redirect( $_SERVER['HTTP_REFERER'] );
		exit();
	}

	$url = wpmu_admin_redirect_add_updated_param( $url );
	if ( isset( $_GET['redirect'] ) ) {
		if ( substr( $_GET['redirect'], 0, 2 ) == 's_' )
			$url .= '&action=blogs&s='. esc_html( substr( $_GET['redirect'], 2 ) );
	} elseif ( isset( $_POST['redirect'] ) ) {
		$url = wpmu_admin_redirect_add_updated_param( $_POST['redirect'] );
	}
	wp_redirect( $url );
	exit();
}

更新日志

Version 描述
3.3.0 Use wp_redirect()
MU Introduced.

相关函数

Uses

  • wp-includes/formatting.php:
    esc_html()
  • wp-includes/pluggable.php:
    wp_redirect()
  • wp-includes/functions.php:
    _deprecated_function()
  • wp-includes/ms-deprecated.php:
    wpmu_admin_redirect_add_updated_param()

User Contributed Notes

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!