WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Filter Reference/search form format

Description

The search_form_format filter allows changing the search box from 'xhtml' to 'html5' and vice versa.

Usage

When the 'search_form_format' filter is called, it is passed one parameter: a string of the format ( html5 or xhtml )

add_filter( 'search_form_format', 'filter_function_name', 10 );

function filter_function_name( $format ) {
    // Alter format
    return $format;
}

Where 'filter_function_name' is the function WordPress should call when filter is run. Note that the filter function must return an value after it is finished processing or the search form will be empty.

filter_function_name should be unique function name. It cannot match any other function name already declared.

Examples

add_filter( 'search_form_format', 'filter_function_name', 10 );

function filter_function_name( $format ) {
    return 'html5';
}

Change Log

See Also