Filter hook 'get_search_form'

in WP Core File wp-includes/general-template.php at line 359

View Source

get_search_form

Filter Hook
Description
Filters the HTML output of the search form.

Hook Information

File Location wp-includes/general-template.php View on GitHub
Hook Type Filter
Line Number 359

Hook Parameters

Type Name Description
string $form The search form HTML output.
array $args The array of arguments for building the search form. See get_search_form() for information on accepted arguments.

Usage Examples

Basic Usage
<?php
// Hook into get_search_form
add_filter('get_search_form', 'my_custom_filter', 10, 2);

function my_custom_filter($form, $args) {
    // Your custom filtering logic here
    return $form;
}

Source Code Context

wp-includes/general-template.php:359 - How this hook is used in WordPress core
<?php
 354  	 *
 355  	 * @param string $form The search form HTML output.
 356  	 * @param array  $args The array of arguments for building the search form.
 357  	 *                     See get_search_form() for information on accepted arguments.
 358  	 */
 359  	$result = apply_filters( 'get_search_form', $form, $args );
 360  
 361  	if ( null === $result ) {
 362  		$result = $form;
 363  	}
 364  

PHP Documentation

<?php
/**
	 * Filters the HTML output of the search form.
	 *
	 * @since 2.7.0
	 * @since 5.5.0 The `$args` parameter was added.
	 *
	 * @param string $form The search form HTML output.
	 * @param array  $args The array of arguments for building the search form.
	 *                     See get_search_form() for information on accepted arguments.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/general-template.php
Related Hooks

Related hooks will be displayed here in future updates.