Title: pre_get_search_form
Published: April 25, 2014
Last modified: May 20, 2026

---

# do_action( ‘pre_get_search_form’, array $args )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/pre_get_search_form/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/pre_get_search_form/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/pre_get_search_form/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/pre_get_search_form/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/pre_get_search_form/?output_format=md#wp--skip-link--target)

Fires before the search form is retrieved, at the start of [get_search_form()](https://developer.wordpress.org/reference/functions/get_search_form/).

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/pre_get_search_form/?output_format=md#parameters)󠁿

 `$args`array

The array of arguments for building the search form.
 See [get_search_form()](https://developer.wordpress.org/reference/functions/get_search_form/)
for information on accepted arguments.

More Arguments from get_search_form( … $args )

Array of display arguments.

 * `echo` bool
 * Whether to echo or return the form. Default true.
 * `aria_label` string
 * ARIA label for the search form. Useful to distinguish multiple search forms on
   the same page and improve accessibility.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/pre_get_search_form/?output_format=md#source)󠁿

    ```php
    do_action( 'pre_get_search_form', $args );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/general-template.php#L254)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/general-template.php#L254-L254)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/pre_get_search_form/?output_format=md#related)󠁿

| Used by | Description | 
| [get_search_form()](https://developer.wordpress.org/reference/functions/get_search_form/)`wp-includes/general-template.php` |

Displays search form.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/pre_get_search_form/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | The `$args` parameter was added. | 
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) |  | 
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fpre_get_search_form%2F)
before being able to contribute a note or feedback.