user_admin_url example

'action'  => 'confirm_admin_email',
                            'wp_lang' => get_user_locale( $user ),
                        ),
                        wp_login_url( $redirect_to )
                    );
                }
            }

            if ( ( empty( $redirect_to ) || 'wp-admin/' === $redirect_to || admin_url() === $redirect_to ) ) {
                // If the user doesn't belong to a blog, send them to user admin. If the user can't edit posts, send them to their profile.                 if ( is_multisite() && ! get_active_blog_for_user( $user->ID ) && ! is_super_admin( $user->ID ) ) {
                    $redirect_to = user_admin_url();
                } elseif ( is_multisite() && ! $user->has_cap( 'read' ) ) {
                    $redirect_to = get_dashboard_url( $user->ID );
                } elseif ( ! $user->has_cap( 'edit_posts' ) ) {
                    $redirect_to = $user->has_cap( 'read' ) ? admin_url( 'profile.php' ) : home_url();
                }

                wp_redirect( $redirect_to );
                exit;
            }

            wp_safe_redirect( $redirect_to );
            
/** * Filters whether to redirect the request to the User Admin in Multisite. * * @since 3.2.0 * * @param bool $redirect_user_admin_request Whether the request should be redirected. */
$redirect_user_admin_request = apply_filters( 'redirect_user_admin_request', $redirect_user_admin_request );

if ( $redirect_user_admin_request ) {
    wp_redirect( user_admin_url() );
    exit;
}

unset( $redirect_user_admin_request );

function self_admin_url( $path = '', $scheme = 'admin' ) {
    if ( is_network_admin() ) {
        $url = network_admin_url( $path$scheme );
    } elseif ( is_user_admin() ) {
        $url = user_admin_url( $path$scheme );
    } else {
        $url = admin_url( $path$scheme );
    }

    /** * Filters the admin URL for the current site or network depending on context. * * @since 4.9.0 * * @param string $url The complete URL including scheme and path. * @param string $path Path relative to the URL. Blank string if no path is specified. * @param string $scheme The scheme to use. */

    public function initialize() {
        $this->user = new stdClass();

        if ( is_user_logged_in() ) {
            /* Populate settings we need for the menu based on the current user. */
            $this->user->blogs = get_blogs_of_user( get_current_user_id() );
            if ( is_multisite() ) {
                $this->user->active_blog    = get_active_blog_for_user( get_current_user_id() );
                $this->user->domain         = empty( $this->user->active_blog ) ? user_admin_url() : trailingslashit( get_home_url( $this->user->active_blog->blog_id ) );
                $this->user->account_domain = $this->user->domain;
            } else {
                $this->user->active_blog    = $this->user->blogs[ get_current_blog_id() ];
                $this->user->domain         = trailingslashit( home_url() );
                $this->user->account_domain = $this->user->domain;
            }
        }

        add_action( 'wp_head', 'wp_admin_bar_header' );

        add_action( 'admin_head', 'wp_admin_bar_header' );

        
Home | Imprint | This part of the site doesn't use cookies.