Filter hook 'search_form_args'

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

View Source

search_form_args

Filter Hook
Description
Filters the array of arguments used when generating the search form.

Hook Information

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

Hook Parameters

Type Name Description
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 search_form_args
add_filter('search_form_args', 'my_custom_filter', 10, 1);

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

Source Code Context

wp-includes/general-template.php:286 - How this hook is used in WordPress core
<?php
 281  	 * @since 5.2.0
 282  	 *
 283  	 * @param array $args The array of arguments for building the search form.
 284  	 *                    See get_search_form() for information on accepted arguments.
 285  	 */
 286  	$args = apply_filters( 'search_form_args', $args );
 287  
 288  	// Ensure that the filtered arguments contain all required default values.
 289  	$args = array_merge( $defaults, $args );
 290  
 291  	$format = current_theme_supports( 'html5', 'search-form' ) ? 'html5' : 'xhtml';

PHP Documentation

<?php
/**
	 * Filters the array of arguments used when generating the search form.
	 *
	 * @since 5.2.0
	 *
	 * @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: 1
  • File: wp-includes/general-template.php
Related Hooks

Related hooks will be displayed here in future updates.