$_REQUEST[‘REDIRECT_TO’]有什么作用?

时间:2017-04-19 作者:Himanshu

我无法理解$\\u请求[\'redirect\\u to\']是如何工作的。从何处获取“redirect\\u to”的值?

 public function render_login_form( $attributes, $content = null ) {
    // Parse shortcode attributes
    $default_attributes = array( \'show_title\' => false );
    $attributes = shortcode_atts( $default_attributes, $attributes );
    $show_title = $attributes[\'show_title\'];

    if ( is_user_logged_in() ) {
        return __( \'You are already signed in.\', \'personalize-login\' );
    }

    // Pass the redirect parameter to the WordPress login functionality: by default,
    // don\'t specify a redirect, but if a valid redirect URL has been passed as
    // request parameter, use it.
    $attributes[\'redirect\'] = \'\';
    if ( isset( $_REQUEST[\'redirect_to\'] ) ) {
        $attributes[\'redirect\'] = wp_validate_redirect( $_REQUEST[\'redirect_to\'], $attributes[\'redirect\'] );
    }

    // Render the login form using an external template
    return $this->get_template_html( \'login_form\', $attributes );

1 个回复
SO网友:Punitkumar Patel

在这里,$\\u REQUEST[\'redirect\\u to\']是WordPress中的默认参数,一旦您在登录或注册时正确登录,就可以重定向。e、 g.用户仪表板。参考号:https://codex.wordpress.org/Plugin_API/Filter_Reference/login_redirect

通常,如果任何凭据或详细信息为false,redirect\\u to将用户重定向到用户仪表板或同一页面。

相关推荐