wp_validate_auth_cookie example


function wp_authenticate_cookie( $user$username$password ) {
    if ( $user instanceof WP_User ) {
        return $user;
    }

    if ( empty( $username ) && empty( $password ) ) {
        $user_id = wp_validate_auth_cookie();
        if ( $user_id ) {
            return new WP_User( $user_id );
        }

        global $auth_secure_cookie;

        if ( $auth_secure_cookie ) {
            $auth_cookie = SECURE_AUTH_COOKIE;
        } else {
            $auth_cookie = AUTH_COOKIE;
        }

        


        /** * Filters the authentication redirect scheme. * * @since 2.9.0 * * @param string $scheme Authentication redirect scheme. Default empty. */
        $scheme = apply_filters( 'auth_redirect_scheme', '' );

        $user_id = wp_validate_auth_cookie( '', $scheme );
        if ( $user_id ) {
            /** * Fires before the authentication redirect. * * @since 2.8.0 * * @param int $user_id User ID. */
            do_action( 'auth_redirect', $user_id );

            // If the user wants ssl but the session is not ssl, redirect.
Home | Imprint | This part of the site doesn't use cookies.