get_admin_url example

// Don't show for logged out users or single site mode.     if ( ! is_user_logged_in() || ! is_multisite() ) {
        return;
    }

    // Show only when the user has at least one site, or they're a super admin.     if ( count( $wp_admin_bar->user->blogs ) < 1 && ! current_user_can( 'manage_network' ) ) {
        return;
    }

    if ( $wp_admin_bar->user->active_blog ) {
        $my_sites_url = get_admin_url( $wp_admin_bar->user->active_blog->blog_id, 'my-sites.php' );
    } else {
        $my_sites_url = admin_url( 'my-sites.php' );
    }

    $wp_admin_bar->add_node(
        array(
            'id'    => 'my-sites',
            'title' => __( 'My Sites' ),
            'href'  => $my_sites_url,
        )
    );

    
require_once ABSPATH . 'wp-admin/admin-header.php';
?> <script type="text/javascript"> var current_site_id = <?php echo absint( $id ); ?>; </script> <div class="wrap"> <h1 id="edit-site"><?php echo $title; ?></h1> <p class="edit-site-actions"><a href="<?php echo esc_url( get_home_url( $id, '/' ) ); ?>"><?php _e( 'Visit' ); ?></a> | <a href="<?php echo esc_url( get_admin_url( $id ) ); ?>"><?php _e( 'Dashboard' ); ?></a></p> <?php
network_edit_site_nav(
    array(
        'blog_id'  => $id,
        'selected' => 'site-users',
    )
);

if ( isset( $_GET['update'] ) ) :
    switch ( $_GET['update'] ) {
        
'readonly' => true,
                'option'   => 'home',
            ),
            'login_url'               => array(
                'desc'     => __( 'Login Address (URL)' ),
                'readonly' => true,
                'value'    => wp_login_url(),
            ),
            'admin_url'               => array(
                'desc'     => __( 'The URL to the admin area' ),
                'readonly' => true,
                'value'    => get_admin_url(),
            ),
            'image_default_link_type' => array(
                'desc'     => __( 'Image default link type' ),
                'readonly' => true,
                'option'   => 'image_default_link_type',
            ),
            'image_default_size'      => array(
                'desc'     => __( 'Image default size' ),
                'readonly' => true,
                'option'   => 'image_default_size',
            ),
            
/* translators: %s: Site title. */
$title = sprintf( __( 'Edit Site: %s' )esc_html( $details->blogname ) );

$parent_file  = 'sites.php';
$submenu_file = 'sites.php';

require_once ABSPATH . 'wp-admin/admin-header.php';
?> <div class="wrap"> <h1 id="edit-site"><?php echo $title; ?></h1> <p class="edit-site-actions"><a href="<?php echo esc_url( get_home_url( $id, '/' ) ); ?>"><?php _e( 'Visit' ); ?></a> | <a href="<?php echo esc_url( get_admin_url( $id ) ); ?>"><?php _e( 'Dashboard' ); ?></a></p> <?php
network_edit_site_nav(
    array(
        'blog_id'  => $id,
        'selected' => 'site-themes',
    )
);

if ( isset( $_GET['enabled'] ) ) {
    $enabled = absint( $_GET['enabled'] );
    
'visit'      => '',
        );

        $actions['edit'] = sprintf(
            '<a href="%1$s">%2$s</a>',
            esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ),
            __( 'Edit' )
        );

        $actions['backend'] = sprintf(
            '<a href="%1$s" class="edit">%2$s</a>',
            esc_url( get_admin_url( $blog['blog_id'] ) ),
            __( 'Dashboard' )
        );

        if ( ! is_main_site( $blog['blog_id'] ) ) {
            if ( '1' === $blog['deleted'] ) {
                $actions['activate'] = sprintf(
                    '<a href="%1$s">%2$s</a>',
                    esc_url(
                        wp_nonce_url(
                            network_admin_url( 'sites.php?action=confirm&amp;action2=activateblog&amp;id=' . $blog['blog_id'] ),
                            'activateblog_' . $blog['blog_id']
                        )
__( 'You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.' ),
        $blog_name
    ) . '</p>';
    $output .= '<p>' . __( 'If you reached this screen by accident and meant to visit one of your own sites, here are some shortcuts to help you find your way.' ) . '</p>';

    $output .= '<h3>' . __( 'Your Sites' ) . '</h3>';
    $output .= '<table>';

    foreach ( $blogs as $blog ) {
        $output .= '<tr>';
        $output .= "<td>{$blog->blogname}</td>";
        $output .= '<td><a href="' . esc_url( get_admin_url( $blog->userblog_id ) ) . '">' . __( 'Visit Dashboard' ) . '</a> | ' .
            '<a href="' . esc_url( get_home_url( $blog->userblog_id ) ) . '">' . __( 'View Site' ) . '</a></td>';
        $output .= '</tr>';
    }

    $output .= '</table>';

    wp_die( $output, 403 );
}

/** * Checks if the current user has permissions to import new users. * * @since 3.0.0 * * @param string $permission A permission to be checked. Currently not used. * @return bool True if the user has proper permissions, false if they do not. */
 else {
        wp_die( $id->get_error_message() );
    }
}

if ( isset( $_GET['update'] ) ) {
    $messages = array();
    if ( 'added' === $_GET['update'] ) {
        $messages[] = sprintf(
            /* translators: 1: Dashboard URL, 2: Network admin edit URL. */
            __( 'Site added. <a href="%1$s">Visit Dashboard</a> or <a href="%2$s">Edit Site</a>' ),
            esc_url( get_admin_url( absint( $_GET['id'] ) ) ),
            network_admin_url( 'site-info.php?id=' . absint( $_GET['id'] ) )
        );
    }
}

// Used in the HTML title tag. $title       = __( 'Add New Site' );
$parent_file = 'sites.php';

wp_enqueue_script( 'user-suggest' );

$title = sprintf( __( 'Edit Site: %s' )esc_html( $details->blogname ) );

$parent_file  = 'sites.php';
$submenu_file = 'sites.php';

require_once ABSPATH . 'wp-admin/admin-header.php';

?> <div class="wrap"> <h1 id="edit-site"><?php echo $title; ?></h1> <p class="edit-site-actions"><a href="<?php echo esc_url( get_home_url( $id, '/' ) ); ?>"><?php _e( 'Visit' ); ?></a> | <a href="<?php echo esc_url( get_admin_url( $id ) ); ?>"><?php _e( 'Dashboard' ); ?></a></p> <?php
network_edit_site_nav(
    array(
        'blog_id'  => $id,
        'selected' => 'site-settings',
    )
);

if ( ! empty( $messages ) ) {
    

                $action = sprintf(
                    '<a href="%1$s" class="install-now" data-slug="%2$s" data-name="%2$s" aria-label="%3$s">%3$s</a>',
                    esc_url( $url ),
                    esc_attr( $plugin_slug ),
                    __( 'Install Now' )
                );
            } else {
                $action = sprintf(
                    /* translators: %s: URL to Press This bookmarklet on the main site. */
                    __( 'Press This is not installed. Please install Press This from <a href="%s">the main site</a>.' ),
                    get_admin_url( get_current_network_id(), 'press-this.php' )
                );
            }
        }
        wp_die(
            __( 'The Press This plugin is required.' ) . '<br />' . $action,
            __( 'Installation Required' ),
            200
        );
    } else {
        wp_die(
            __( 'Press This is not available. Please contact your site administrator.' ),
            
$title = sprintf( __( 'Edit Site: %s' )esc_html( $details->blogname ) );

$parent_file  = 'sites.php';
$submenu_file = 'sites.php';

require_once ABSPATH . 'wp-admin/admin-header.php';

?> <div class="wrap"> <h1 id="edit-site"><?php echo $title; ?></h1> <p class="edit-site-actions"><a href="<?php echo esc_url( get_home_url( $id, '/' ) ); ?>"><?php _e( 'Visit' ); ?></a> | <a href="<?php echo esc_url( get_admin_url( $id ) ); ?>"><?php _e( 'Dashboard' ); ?></a></p> <?php
network_edit_site_nav(
    array(
        'blog_id'  => $id,
        'selected' => 'site-info',
    )
);

if ( ! empty( $messages ) ) {
    foreach ( $messages as $msg ) {
        

    protected function get_views() {
        $current_status = isset( $_REQUEST['filter-status'] ) ? sanitize_text_field( $_REQUEST['filter-status'] ) : '';
        $statuses       = _wp_privacy_statuses();
        $views          = array();
        $counts         = $this->get_request_counts();
        $total_requests = absint( array_sum( (array) $counts ) );

        // Normalized admin URL.         $admin_url = $this->get_admin_url();

        $status_label = sprintf(
            /* translators: %s: Number of requests. */
            _nx(
                'All <span class="count">(%s)</span>',
                'All <span class="count">(%s)</span>',
                $total_requests,
                'requests'
            ),
            number_format_i18n( $total_requests )
        );

        
esc_url( $url ),
                        esc_attr( $plugin_slug ),
                        esc_attr( $data[0] ),
                        /* translators: %s: Importer name. */
                        esc_attr( sprintf( _x( 'Install %s now', 'plugin' )$data[0] ) ),
                        __( 'Install Now' )
                    );
                } else {
                    $action = sprintf(
                        /* translators: %s: URL to Import screen on the main site. */
                        __( 'This importer is not installed. Please install importers from <a href="%s">the main site</a>.' ),
                        get_admin_url( get_current_network_id(), 'import.php' )
                    );
                }
            }
        } else {
            $url    = add_query_arg(
                array(
                    'import' => $importer_id,
                ),
                self_admin_url( 'admin.php' )
            );
            $action = sprintf(
                
/** * Retrieves the URL to the admin area for the current site. * * @since 2.6.0 * * @param string $path Optional. Path relative to the admin URL. Default empty. * @param string $scheme The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl(). * 'http' or 'https' can be passed to force those schemes. * @return string Admin URL link with optional path appended. */
function admin_url( $path = '', $scheme = 'admin' ) {
    return get_admin_url( null, $path$scheme );
}

/** * Retrieves the URL to the admin area for a given site. * * @since 3.0.0 * * @param int|null $blog_id Optional. Site ID. Default null (current site). * @param string $path Optional. Path relative to the admin URL. Default empty. * @param string $scheme Optional. The scheme to use. Accepts 'http' or 'https', * to force those schemes. Default 'admin', which obeys * force_ssl_admin() and is_ssl(). * @return string Admin URL link with optional path appended. */
Home | Imprint | This part of the site doesn't use cookies.