The install_search_form() WordPress PHP function displays a search form for searching plugins.
Usage
install_search_form( $deprecated );
Custom example:
install_search_form( true );
Parameters
$deprecated
(bool) (Optional) Not used. Default value: true
More information
See WordPress Developer Resources: install_search_form
Examples
Basic usage of the function
Display the search form for searching plugins.
// Display the search form install_search_form();
Using the default value for the $deprecated
parameter
Display the search form with the default $deprecated
value (true).
// Display the search form install_search_form( true );
Using the false value for the $deprecated
parameter
Display the search form with the $deprecated
value set to false.
// Display the search form install_search_form( false );
Integrating the function in a custom plugin admin page
Create a custom plugin admin page that includes the search form for searching plugins.
// Create a custom plugin admin page function custom_plugin_admin_page() { add_menu_page( 'Custom Plugin Page', 'Custom Plugin', 'manage_options', 'custom-plugin', 'custom_plugin_page_content', 'dashicons-admin-plugins', 6 ); } add_action('admin_menu', 'custom_plugin_admin_page'); // Define the content of the custom plugin admin page function custom_plugin_page_content() { echo '<h1>Search for Plugins</h1>'; install_search_form(); }
Use the function in a custom widget
Create a custom widget that displays the plugin search form in the sidebar.
// Register a custom widget function custom_plugin_search_widget() { register_widget( 'Plugin_Search_Widget' ); } add_action( 'widgets_init', 'custom_plugin_search_widget' ); // Define the custom widget class Plugin_Search_Widget extends WP_Widget { function __construct() { parent::__construct( 'plugin_search_widget', 'Plugin Search', array( 'description' => 'A widget to search for plugins' ) ); } public function widget( $args, $instance ) { echo $args['before_widget']; echo $args['before_title'] . 'Search for Plugins' . $args['after_title']; install_search_form(); echo $args['after_widget']; } }