network_home_url example


/** Sets up the WordPress Environment. */
require __DIR__ . '/wp-load.php';

add_filter( 'wp_robots', 'wp_robots_no_robots' );

require __DIR__ . '/wp-blog-header.php';

nocache_headers();

if ( is_array( get_site_option( 'illegal_names' ) ) && isset( $_GET['new'] ) && in_array( $_GET['new']get_site_option( 'illegal_names' ), true ) ) {
    wp_redirect( network_home_url() );
    die();
}

/** * Prints signup_header via wp_head. * * @since MU (3.0.0) */
function do_signup_header() {
    /** * Fires within the head section of the site sign-up screen. * * @since 3.0.0 */

function get_blogaddress_by_name( $blogname ) {
    if ( is_subdomain_install() ) {
        if ( 'main' === $blogname ) {
            $blogname = 'www';
        }
        $url = rtrim( network_home_url(), '/' );
        if ( ! empty( $blogname ) ) {
            $url = preg_replace( '|^([^\.]+://)|', '${1}' . $blogname . '.', $url );
        }
    } else {
        $url = network_home_url( $blogname );
    }
    return esc_url( $url . '/' );
}

/** * Retrieves a site's ID given its (subdomain or directory) slug. * * @since MU (3.0.0) * @since 4.7.0 Converted to use `get_sites()`. * * @param string $slug A site's slug. * @return int|null The site ID, or null if no site is found for the given slug. */


        /* * If we don't have an email from the input headers, default to wordpress@$sitename * Some hosts will block outgoing mail from this address if it doesn't exist, * but there's no easy alternative. Defaulting to admin_email might appear to be * another option, but some hosts may refuse to relay mail from an unknown domain. * See https://core.trac.wordpress.org/ticket/5007. */
        if ( ! isset( $from_email ) ) {
            // Get the site domain and get rid of www.             $sitename   = wp_parse_url( network_home_url(), PHP_URL_HOST );
            $from_email = 'wordpress@';

            if ( null !== $sitename ) {
                if ( str_starts_with( $sitename, 'www.' ) ) {
                    $sitename = substr( $sitename, 4 );
                }

                $from_email .= $sitename;
            }
        }

        

    $content = apply_filters( 'delete_site_email_content', $content );

    $content = str_replace( '###USERNAME###', $user->user_login, $content );
    $content = str_replace( '###URL_DELETE###', $url_delete$content );
    $content = str_replace( '###SITENAME###', get_network()->site_name, $content );
    $content = str_replace( '###SITEURL###', network_home_url()$content );

    wp_mail(
        get_option( 'admin_email' ),
        sprintf(
            /* translators: %s: Site title. */
            __( '[%s] Delete My Site' ),
            wp_specialchars_decode( get_option( 'blogname' ) )
        ),
        $content
    );

    
$url  = isset( $result['blog_id'] ) ? get_home_url( (int) $result['blog_id'] ) : '';
            $user = get_userdata( (int) $result['user_id'] );
            ?> <h2><?php _e( 'Your account is now active!' ); ?></h2> <div id="signup-welcome"> <p><span class="h3"><?php _e( 'Username:' ); ?></span> <?php echo $user->user_login; ?></p> <p><span class="h3"><?php _e( 'Password:' ); ?></span> <?php echo $result['password']; ?></p> </div> <?php             if ( $url && network_home_url( '', 'http' ) !== $url ) :
                switch_to_blog( (int) $result['blog_id'] );
                $login_url = wp_login_url();
                restore_current_blog();
                ?> <p class="view"> <?php                     /* translators: 1: Site URL, 2: Login URL. */
                    printf( __( 'Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Log in</a>' )$urlesc_url( $login_url ) );
                ?> </p> <?php else : ?>

    protected function send_debug_email() {
        $update_count = 0;
        foreach ( $this->update_results as $type => $updates ) {
            $update_count += count( $updates );
        }

        $body     = array();
        $failures = 0;

        /* translators: %s: Network home URL. */
        $body[] = sprintf( __( 'WordPress site: %s' )network_home_url( '/' ) );

        // Core.         if ( isset( $this->update_results['core'] ) ) {
            $result = $this->update_results['core'][0];

            if ( $result->result && ! is_wp_error( $result->result ) ) {
                /* translators: %s: WordPress version. */
                $body[] = sprintf( __( 'SUCCESS: WordPress was successfully updated to %s' )$result->name );
            } else {
                /* translators: %s: WordPress version. */
                $body[] = sprintf( __( 'FAILED: WordPress failed to update to %s' )$result->name );
                
/** * Returns the URL of the site. * * @since 2.5.0 * * @return string Site URL. */
    function wxr_site_url() {
        if ( is_multisite() ) {
            // Multisite: the base URL.             return network_home_url();
        } else {
            // WordPress (single site): the site URL.             return get_bloginfo_rss( 'url' );
        }
    }

    /** * Outputs a cat_name XML tag from a given category object. * * @since 2.1.0 * * @param WP_Term $category Category Object. */
    if ( ! is_subdomain_install() || get_current_network_id() != 1 ) {
        $activate_url = network_site_url( "wp-activate.php?key=$key);
    } else {
        $activate_url = "http://{$domain}{$path}wp-activate.php?key=$key"; // @todo Use *_url() API.     }

    $activate_url = esc_url( $activate_url );

    $admin_email = get_site_option( 'admin_email' );

    if ( '' === $admin_email ) {
        $admin_email = 'support@' . wp_parse_url( network_home_url(), PHP_URL_HOST );
    }

    $from_name       = ( '' !== get_site_option( 'site_name' ) ) ? esc_html( get_site_option( 'site_name' ) ) : 'WordPress';
    $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . 'Content-Type: text/plain; charset="' . get_option( 'blog_charset' ) . "\"\n";

    $user            = get_user_by( 'login', $user_login );
    $switched_locale = $user && switch_to_user_locale( $user->ID );

    $message = sprintf(
        /** * Filters the message content of the new blog notification email. * * Content should be formatted for transmission via wp_mail(). * * @since MU (3.0.0) * * @param string $content Content of the notification email. * @param string $domain Site domain. * @param string $path Site path. * @param string $title Site title. * @param string $user_login User login name. * @param string $user_email User email address. * @param string $key Activation key created in wpmu_signup_blog(). * @param array $meta Signup meta data. By default, contains the requested privacy setting and lang_id. */
$first_post = get_site_option( 'first_post' );

            if ( ! $first_post ) {
                $first_post = "<!-- wp:paragraph -->\n<p>" .
                /* translators: First post content. %s: Site link. */
                __( 'Welcome to %s. This is your first post. Edit or delete it, then start writing!' ) .
                "</p>\n<!-- /wp:paragraph -->";
            }

            $first_post = sprintf(
                $first_post,
                sprintf( '<a href="%s">%s</a>', esc_url( network_home_url() )get_network()->site_name )
            );

            // Back-compat for pre-4.4.             $first_post = str_replace( 'SITE_URL', esc_url( network_home_url() )$first_post );
            $first_post = str_replace( 'SITE_NAME', get_network()->site_name, $first_post );
        } else {
            $first_post = "<!-- wp:paragraph -->\n<p>" .
            /* translators: First post content. %s: Site link. */
            __( 'Welcome to WordPress. This is your first post. Edit or delete it, then start writing!' ) .
            "</p>\n<!-- /wp:paragraph -->";
        }

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