show_blog_form( string $blogname = '', string $blog_title = '', WP_Error|string $errors = '' )
- Since
- MU (3.0.0)
- Source
wp-signup.php:123
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
- Scaling
- Constant
- Instructions
- 102–175
- Plugin surface
- 1 hook
- Called by
- 2
Reads stored settings via get_site_option(), cached per request but not free on a cold cache.
No loop in the body: the same number of instructions runs whatever you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 203.
Third-party callbacks on 'signup_blogform' run inside this call, and their cost is not bounded by anything here.
2 places in core call this, so the cost is paid more often than your own code shows.
What it touches
- optionnetwork option
get_site_option()called directly - hookthird-party callbacks
do_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.
| When | Instructions | Calls it makes |
|---|---|---|
!is_subdomain_install() && is_user_logged_in() && empty($languages) | 102–119 | is_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–121 | is_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–147 | is_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–145 | is_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–149 | is_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–147 | is_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–173 | is_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–175 | is_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
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 204 | 102–176 | 12 | 1 more instruction than PHP 8.5 |
| 8.5 | 203 | 102–175 | 12 | |
| 8.4 | 203 | 102–175 | 12 | 7 fewer instructions than PHP 8.3 |
| 8.3 | 210 | 102–182 | 12 | |
| 8.2 | 210 | 102–182 | 12 | |
| 8.1 | 210 | 102–182 | 12 | |
| 7.4 | 210 | 102–182 | 12 |
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:
Uses · 13
- is_wp_error()Checks whether the given variable is a WordPress Error.
- get_network()Retrieves network data given a network ID or network object.
- is_subdomain_install()Whether a subdomain configuration is enabled.
- __()Retrieves the translation of $text.
- esc_attr()Escaping for HTML attributes.
- esc_html()Escaping for HTML blocks.
- is_user_logged_in()Determines whether the current visitor is a logged in user.
- _e()Displays translated text.
- signup_get_available_languages()Retrieves languages available during the site/user sign-up process.
- get_site_option()Retrieve an option value for the current network based on name of option.
- wp_dropdown_languages()Displays or returns a Language selector.
- do_action()Calls the callback functions that have been added to an action hook.
Show all 13
- WP_Error::__construct()Initializes the error.
Used by · 2
- signup_another_blog()Shows a form for returning users to sign up for another site.
- signup_blog()Shows a form for a user or visitor to sign up for a new site.
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' ); ?><span class="dashicons dashicons-translation" aria-hidden="true"></span></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.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 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.