install_theme_search_form( bool $type_selector = true )
- Since
- 2.8.0
- Source
wp-admin/includes/theme-install.php:91
Compatibility
- WordPress
- since 2.8.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
$type_selectorbooloptional- Default:
true
Performance profile
How much work a call to install_theme_search_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
- Trivial
- Scaling
- Constant
- Instructions
- 36–96
- Plugin surface
- None
- Called by
- 1
Touches nothing outside its own arguments.
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 112.
Nothing here hands control to plugin code.
1 place in core call this, so the cost is paid more often than your own code shows.
What it touches
- hookthird-party callbacks
apply_filters()one call below install_theme_search_form()
Further down the call graph this can also reach option, cache, serialize, query and transient. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 18 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost install_theme_search_form() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!isset($value) | 36 | _e(), esc_attr(), __(), submit_button() |
!isset($value) | 42 | __(), _e(), esc_attr(), __(), submit_button() |
| always | 43 | wp_unslash(), _e(), esc_attr(), __(), submit_button() |
| always | 49 | wp_unslash(), __(), _e(), esc_attr(), __(), submit_button() |
isset($value) | 50 | wp_unslash(), wp_unslash(), _e(), esc_attr(), __(), submit_button() |
isset($value) | 56 | wp_unslash(), wp_unslash(), __(), _e(), esc_attr(), __(), submit_button() |
!isset($value) | 67–74 | _e(), selected(), _e(), selected(), _e(), selected(), _ex(), esc_attr(), __(), submit_button() |
!isset($value) | 70–76 | _e(), selected(), _e(), selected(), _e(), selected(), _ex(), _e(), esc_attr(), __(), submit_button() |
!isset($value) | 73–80 | __(), _e(), selected(), _e(), selected(), _e(), selected(), _ex(), esc_attr(), __(), submit_button() |
| always | 74–81 | wp_unslash(), _e(), selected(), _e(), selected(), _e(), selected(), _ex(), esc_attr(), __(), submit_button() |
!isset($value) | 76–82 | __(), _e(), selected(), _e(), selected(), _e(), selected(), _ex(), _e(), esc_attr(), __(), submit_button() |
| always | 77–83 | wp_unslash(), _e(), selected(), _e(), selected(), _e(), selected(), _ex(), _e(), esc_attr(), __(), submit_button() |
6 further outcomes, up to 96 instructions
| always | 80–87 | wp_unslash(), __(), _e(), selected(), _e(), selected(), _e(), selected(), _ex(), esc_attr(), __(), submit_button() |
isset($value) | 81–88 | wp_unslash(), wp_unslash(), _e(), selected(), _e(), selected(), _e(), selected(), _ex(), esc_attr(), __(), submit_button() |
| always | 83–89 | wp_unslash(), __(), _e(), selected(), _e(), selected(), _e(), selected(), _ex(), _e(), esc_attr(), __(), submit_button() |
isset($value) | 84–90 | wp_unslash(), wp_unslash(), _e(), selected(), _e(), selected(), _e(), selected(), _ex(), _e(), esc_attr(), __(), submit_button() |
isset($value) | 87–94 | wp_unslash(), wp_unslash(), __(), _e(), selected(), _e(), selected(), _e(), selected(), _ex(), esc_attr(), __(), submit_button() |
isset($value) | 90–96 | wp_unslash(), wp_unslash(), __(), _e(), selected(), _e(), selected(), _e(), selected(), _ex(), _e(), esc_attr(), __(), submit_button() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 110 | 36–94 | 8 | 2 fewer instructions than PHP 8.5 |
| 8.5 | 112 | 36–96 | 8 | |
| 8.4 | 112 | 36–96 | 8 | |
| 8.3 | 112 | 36–96 | 8 | |
| 8.2 | 112 | 36–96 | 8 | 1 more instruction than PHP 8.1 |
| 8.1 | 111 | 36–97 | 8 | |
| 7.4 | 111 | 36–97 | 8 |
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.
Uses · 7
- wp_unslash()Removes slashes from a string or recursively removes slashes from strings within an array.
- __()Retrieves the translation of $text.
- _e()Displays translated text.
- selected()Outputs the HTML selected attribute.
- _ex()Displays translated string with gettext context.
- esc_attr()Escaping for HTML attributes.
- submit_button()Echoes a submit button, with provided text and appropriate class(es).
Used by · 1
- install_themes_dashboard()Displays tags filter for themes.
Source code
function install_theme_search_form( $type_selector = true ) { $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term'; $term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : ''; if ( ! $type_selector ) { echo '<p class="install-help">' . __( 'Search for themes by keyword.' ) . '</p>'; } ?><form id="search-themes" method="get"> <input type="hidden" name="tab" value="search" /> <?php if ( $type_selector ) : ?> <label class="screen-reader-text" for="typeselector"> <?php /* translators: Hidden accessibility text. */ _e( 'Type of search' ); ?> </label> <select name="type" id="typeselector"> <option value="term" <?php selected( 'term', $type ); ?>><?php _e( 'Keyword' ); ?></option> <option value="author" <?php selected( 'author', $type ); ?>><?php _e( 'Author' ); ?></option> <option value="tag" <?php selected( 'tag', $type ); ?>><?php _ex( 'Tag', 'Theme Installer' ); ?></option> </select> <label class="screen-reader-text" for="s"> <?php switch ( $type ) { case 'term': /* translators: Hidden accessibility text. */ _e( 'Search by keyword' ); break; case 'author': /* translators: Hidden accessibility text. */ _e( 'Search by author' ); break; case 'tag': /* translators: Hidden accessibility text. */ _e( 'Search by tag' ); break; } ?> </label> <?php else : ?> <label class="screen-reader-text" for="s"> <?php /* translators: Hidden accessibility text. */ _e( 'Search by keyword' ); ?> </label> <?php endif; ?> <input type="search" name="s" id="s" size="30" value="<?php echo esc_attr( $term ); ?>" autofocus="autofocus" /> <?php submit_button( __( 'Search' ), '', 'search', false ); ?></form> <?php}Changelog
Introduced in 2.8.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 6.8.8 tag, from
src/wp-admin/includes/theme-install.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.