search_form_format
Filter HookDescription
Filters the HTML format of the search form.Hook Information
File Location |
wp-includes/general-template.php
View on GitHub
|
Hook Type | Filter |
Line Number | 304 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$format
|
The type of markup to use in the search form. Accepts 'html5', 'xhtml'. |
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_format
add_filter('search_form_format', 'my_custom_filter', 10, 2);
function my_custom_filter($format, $args) {
// Your custom filtering logic here
return $format;
}
Source Code Context
wp-includes/general-template.php:304
- How this hook is used in WordPress core
<?php
299 * @param string $format The type of markup to use in the search form.
300 * Accepts 'html5', 'xhtml'.
301 * @param array $args The array of arguments for building the search form.
302 * See get_search_form() for information on accepted arguments.
303 */
304 $format = apply_filters( 'search_form_format', $format, $args );
305
306 $search_form_template = locate_template( 'searchform.php' );
307
308 if ( '' !== $search_form_template ) {
309 ob_start();
PHP Documentation
<?php
/**
* Filters the HTML format of the search form.
*
* @since 3.6.0
* @since 5.5.0 The `$args` parameter was added.
*
* @param string $format The type of markup to use in the search form.
* Accepts 'html5', 'xhtml'.
* @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.