WP_Plugins_List_Table::search_box()publicWP 4.6.0

Displays the search box.

Method of the class: WP_Plugins_List_Table{}

No Hooks.

Return

null. Nothing (null).

Usage

$WP_Plugins_List_Table = new WP_Plugins_List_Table();
$WP_Plugins_List_Table->search_box( $text, $input_id );
$text(string) (required)
The 'submit' button label.
$input_id(string) (required)
ID attribute value for the search input field.

Changelog

Since 4.6.0 Introduced.

WP_Plugins_List_Table::search_box() code WP 6.5.2

<?php
public function search_box( $text, $input_id ) {
	if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
		return;
	}

	$input_id = $input_id . '-search-input';

	if ( ! empty( $_REQUEST['orderby'] ) ) {
		echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
	}
	if ( ! empty( $_REQUEST['order'] ) ) {
		echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
	}
	?>
	<p class="search-box">
		<label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo $text; ?>:</label>
		<input type="search" id="<?php echo esc_attr( $input_id ); ?>" class="wp-filter-search" name="s" value="<?php _admin_search_query(); ?>" placeholder="<?php esc_attr_e( 'Search installed plugins...' ); ?>" />
		<?php submit_button( $text, 'hide-if-js', '', false, array( 'id' => 'search-submit' ) ); ?>
	</p>
	<?php
}