pre_get_search_form
Action HookDescription
Fires before the search form is retrieved, at the start of get_search_form().Hook Information
File Location |
wp-includes/general-template.php
View on GitHub
|
Hook Type | Action |
Line Number | 254 |
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 pre_get_search_form
add_action('pre_get_search_form', 'my_custom_function', 10, 1);
function my_custom_function($args) {
// Your custom code here
}
Source Code Context
wp-includes/general-template.php:254
- How this hook is used in WordPress core
<?php
249 * @link https://core.trac.wordpress.org/ticket/19321
250 *
251 * @param array $args The array of arguments for building the search form.
252 * See get_search_form() for information on accepted arguments.
253 */
254 do_action( 'pre_get_search_form', $args );
255
256 $echo = true;
257
258 if ( ! is_array( $args ) ) {
259 /*
PHP Documentation
<?php
/**
* Fires before the search form is retrieved, at the start of get_search_form().
*
* @since 2.7.0 as 'get_search_form' action.
* @since 3.6.0
* @since 5.5.0 The `$args` parameter was added.
*
* @link https://core.trac.wordpress.org/ticket/19321
*
* @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: Action
- Parameters: 1
- File: wp-includes/general-template.php
Related Hooks
Related hooks will be displayed here in future updates.