wppaste
WordPress

show_blog_form( string $blogname = '', string $blog_title = '', WP_Error|string $errors = '' )

Since
MU (3.0.0)
Source
wp-signup.php:117
Generates and displays the Sign-up and Create Site forms.

Compatibility

WordPress
since MU (3.0.0)
PHP
7.4–8.6-dev
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.

Parameters

$blognamestringoptional
The new site name.Default: ''
$blog_titlestringoptional
The new site title.Default: ''
$errorsWP_Error|stringoptional
A WP_Error object containing existing errors. Defaults to empty string.Default: ''

Performance profile

How much work a call to show_blog_form() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.

Cost class
Moderate

Reads stored settings via get_site_option(), cached per request but not free on a cold cache.

Scaling
Constant

No loop in the body: the same number of instructions runs whatever you pass in.

Instructions
102–175

Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 203.

Plugin surface
1 hook

Third-party callbacks on 'signup_blogform' run inside this call, and their cost is not bounded by anything here.

Called by
2

2 places in core call this, so the cost is paid more often than your own code shows.

What it touches

  • optionnetwork optionget_site_option()called directly
  • hookthird-party callbacksdo_action()called directly

Further down the call graph this can also reach cache, serialize, transient, http and query. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.

What one call costs · 8 distinct outcomes

One number would be a lie: the work depends on which branch runs. These are every distinct cost show_blog_form() can have, taken from its control-flow graph on PHP 8.5.

WhenInstructionsCalls it makes
!is_subdomain_install() && is_user_logged_in() && empty($languages)102–119is_wp_error(), get_network(), is_subdomain_install(), __(), ->get_error_message(), is_subdomain_install(), esc_attr(), is_user_logged_in(), _e(), ->get_error_message(), esc_attr(), signup_get_available_languages(), _e(), _e(), _e(), _e(), do_action()
is_subdomain_install() && is_user_logged_in() && empty($languages)104–121is_wp_error(), get_network(), is_subdomain_install(), __(), ->get_error_message(), is_subdomain_install(), esc_attr(), esc_html(), is_user_logged_in(), _e(), ->get_error_message(), esc_attr(), signup_get_available_languages(), _e(), _e(), _e(), _e(), do_action()
!is_subdomain_install() && is_user_logged_in() && !empty($languages)126–147is_wp_error(), get_network(), is_subdomain_install(), __(), ->get_error_message(), is_subdomain_install(), esc_attr(), is_user_logged_in(), _e(), ->get_error_message(), esc_attr(), signup_get_available_languages(), _e(), get_site_option(), WPLANG(), _e(), _e(), _e(), _e(), do_action()
!is_subdomain_install() && !is_user_logged_in() && empty($languages)127–145is_wp_error(), get_network(), is_subdomain_install(), __(), ->get_error_message(), is_subdomain_install(), esc_attr(), is_user_logged_in(), is_subdomain_install(), __(), __(), sprintf(), __(), printf(), _e(), ->get_error_message(), esc_attr(), signup_get_available_languages(), _e(), _e(), _e(), _e(), do_action()
is_subdomain_install() && is_user_logged_in() && !empty($languages)128–149is_wp_error(), get_network(), is_subdomain_install(), __(), ->get_error_message(), is_subdomain_install(), esc_attr(), esc_html(), is_user_logged_in(), _e(), ->get_error_message(), esc_attr(), signup_get_available_languages(), _e(), get_site_option(), WPLANG(), _e(), _e(), _e(), _e(), do_action()
is_subdomain_install() && !is_user_logged_in() && empty($languages)129–147is_wp_error(), get_network(), is_subdomain_install(), __(), ->get_error_message(), is_subdomain_install(), esc_attr(), esc_html(), is_user_logged_in(), is_subdomain_install(), __(), __(), sprintf(), __(), printf(), _e(), ->get_error_message(), esc_attr(), signup_get_available_languages(), _e(), _e(), _e(), _e(), do_action()
!is_subdomain_install() && !is_user_logged_in() && !empty($languages)151–173is_wp_error(), get_network(), is_subdomain_install(), __(), ->get_error_message(), is_subdomain_install(), esc_attr(), is_user_logged_in(), is_subdomain_install(), __(), __(), sprintf(), __(), printf(), _e(), ->get_error_message(), esc_attr(), signup_get_available_languages(), _e(), get_site_option(), WPLANG(), _e(), _e(), _e(), _e(), do_action()
is_subdomain_install() && !is_user_logged_in() && !empty($languages)153–175is_wp_error(), get_network(), is_subdomain_install(), __(), ->get_error_message(), is_subdomain_install(), esc_attr(), esc_html(), is_user_logged_in(), is_subdomain_install(), __(), __(), sprintf(), __(), printf(), _e(), ->get_error_message(), esc_attr(), signup_get_available_languages(), _e(), get_site_option(), WPLANG(), _e(), _e(), _e(), _e(), do_action()

Across PHP versions

PHPCompiledExecutedBranchesNotes
8.6-dev204102–176121 more instruction than PHP 8.5
8.5203102–17512
8.4203102–175127 fewer instructions than PHP 8.3
8.3210102–18212
8.2210102–18212
8.1210102–18212
7.4210102–18212

An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.

Hooks and filters fired · 1

One hook fires while show_blog_form() runs, in this order:

  1. do_action( signup_blogform )actionline 243 (+126 into the body)

    Fires after the site sign-up form.

Uses · 13

Show all 13

Used by · 2

Source code

function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) {	if ( ! is_wp_error( $errors ) ) {		$errors = new WP_Error();	} 	$current_network = get_network();	// Site name.	if ( ! is_subdomain_install() ) {		echo '<label for="blogname">' . __( 'Site Name (subdirectory only):' ) . '</label>';	} else {		echo '<label for="blogname">' . __( 'Site Domain (subdomain only):' ) . '</label>';	} 	$errmsg_blogname      = $errors->get_error_message( 'blogname' );	$errmsg_blogname_aria = '';	if ( $errmsg_blogname ) {		$errmsg_blogname_aria = 'wp-signup-blogname-error ';		echo '<p class="error" id="wp-signup-blogname-error">' . $errmsg_blogname . '</p>';	} 	if ( ! is_subdomain_install() ) {		echo '<div class="wp-signup-blogname"><span class="prefix_address" id="prefix-address">' . $current_network->domain . $current_network->path . '</span><input name="blogname" type="text" id="blogname" value="' . esc_attr( $blogname ) . '" maxlength="60" autocomplete="off" required="required" aria-describedby="' . $errmsg_blogname_aria . 'prefix-address" /></div>';	} else {		$site_domain = preg_replace( '|^www\.|', '', $current_network->domain );		echo '<div class="wp-signup-blogname"><input name="blogname" type="text" id="blogname" value="' . esc_attr( $blogname ) . '" maxlength="60" autocomplete="off" required="required" aria-describedby="' . $errmsg_blogname_aria . 'suffix-address" /><span class="suffix_address" id="suffix-address">.' . esc_html( $site_domain ) . '</span></div>';	} 	if ( ! is_user_logged_in() ) {		if ( ! is_subdomain_install() ) {			$site = $current_network->domain . $current_network->path . __( 'sitename' );		} else {			$site = __( 'domain' ) . '.' . $site_domain . $current_network->path;		} 		printf(			'<p>(<strong>%s</strong>) %s</p>',			/* translators: %s: Site address. */			sprintf( __( 'Your address will be %s.' ), $site ),			__( 'Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!' )		);	} 	// Site Title.	?>	<label for="blog_title"><?php _e( 'Site Title:' ); ?></label>	<?php	$errmsg_blog_title      = $errors->get_error_message( 'blog_title' );	$errmsg_blog_title_aria = '';	if ( $errmsg_blog_title ) {		$errmsg_blog_title_aria = ' aria-describedby="wp-signup-blog-title-error"';		echo '<p class="error" id="wp-signup-blog-title-error">' . $errmsg_blog_title . '</p>';	}	echo '<input name="blog_title" type="text" id="blog_title" value="' . esc_attr( $blog_title ) . '" required="required" autocomplete="off"' . $errmsg_blog_title_aria . ' />';	?> 	<?php	// Site Language.	$languages = signup_get_available_languages(); 	if ( ! empty( $languages ) ) :		?>		<p>			<label for="site-language"><?php _e( 'Site Language:' ); ?></label>			<?php			// Network default.			$lang = get_site_option( 'WPLANG' ); 			if ( isset( $_POST['WPLANG'] ) ) {				$lang = $_POST['WPLANG'];			} 			// Use US English if the default isn't available.			if ( ! in_array( $lang, $languages, true ) ) {				$lang = '';			} 			wp_dropdown_languages(				array(					'name'                        => 'WPLANG',					'id'                          => 'site-language',

Changelog

Introduced in MU (3.0.0). Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.9.7 tag, from src/wp-signup.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.