wppaste
WordPress

install_search_form( bool $deprecated = true )

Since
2.7.0, 4.6.0
Source
wp-admin/includes/plugin-install.php:313
Displays a search form for searching plugins.

Compatibility

WordPress
since 4.6.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

$deprecatedbooloptional
Not used.Default: true

Performance profile

How much work a call to install_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

Touches nothing outside its own arguments.

Scaling
Constant

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

Instructions
65–82

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

Plugin surface
None

Nothing here hands control to plugin code.

Called by
1

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

What it touches

  • hookthird-party callbacksapply_filters()one call below install_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 · 4 distinct outcomes

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

WhenInstructionsCalls it makes
!isset($value)65_e(), esc_attr(), _e(), selected(), _e(), selected(), _e(), selected(), _ex(), __(), submit_button()
always72wp_unslash(), _e(), esc_attr(), _e(), selected(), _e(), selected(), _e(), selected(), _ex(), __(), submit_button()
always75wp_unslash(), urldecode(), _e(), esc_attr(), _e(), selected(), _e(), selected(), _e(), selected(), _ex(), __(), submit_button()
isset($value)82wp_unslash(), wp_unslash(), urldecode(), _e(), esc_attr(), _e(), selected(), _e(), selected(), _e(), selected(), _ex(), __(), submit_button()

Across PHP versions

PHPCompiledExecutedBranchesNotes
8.6-dev8265–8022 fewer instructions than PHP 8.5
8.58465–822
8.48465–822
8.38465–822
8.28465–822
8.18465–822
7.48465–822

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.
  • _e()Displays translated text.
  • esc_attr()Escaping for HTML attributes.
  • selected()Outputs the HTML selected attribute.
  • _ex()Displays translated string with gettext context.
  • submit_button()Echoes a submit button, with provided text and appropriate class(es).
  • __()Retrieves the translation of $text.

Used by · 1

Source code

function install_search_form( $deprecated = true ) {	$type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term';	$term = isset( $_REQUEST['s'] ) ? urldecode( wp_unslash( $_REQUEST['s'] ) ) : '';	?>	<form class="search-form search-plugins" method="get">		<input type="hidden" name="tab" value="search" />		<label for="search-plugins"><?php _e( 'Search Plugins' ); ?></label>		<input type="search" name="s" id="search-plugins" value="<?php echo esc_attr( $term ); ?>" class="wp-filter-search" />		<label class="screen-reader-text" for="typeselector">			<?php			/* translators: Hidden accessibility text. */			_e( 'Search plugins by:' );			?>		</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', 'Plugin Installer' ); ?></option>		</select>		<?php submit_button( __( 'Search Plugins' ), 'hide-if-js', false, false, array( 'id' => 'search-submit' ) ); ?>	</form>	<?php}

Changelog

Introduced in 2.7.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.

4.6.0
The $type_selector parameter was deprecated.from the docblock
2.7.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 6.7.7 tag, from src/wp-admin/includes/plugin-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.