search_rewrite_rules filter-hookWP 1.5.0

Filters rewrite rules used for search archives.

Likely search-related archives include /search/search+query/ as well as pagination and feed paths for a search.

Usage

add_filter( 'search_rewrite_rules', 'wp_kama_search_rewrite_rules_filter' );

/**
 * Function for `search_rewrite_rules` filter-hook.
 * 
 * @param string[] $search_rewrite Array of rewrite rules for search queries, keyed by their regex pattern.
 *
 * @return string[]
 */
function wp_kama_search_rewrite_rules_filter( $search_rewrite ){

	// filter...
	return $search_rewrite;
}
$search_rewrite(string[])
Array of rewrite rules for search queries, keyed by their regex pattern.

Changelog

Since 1.5.0 Introduced.

Where the hook is called

WP_Rewrite::rewrite_rules()
search_rewrite_rules
wp-includes/class-wp-rewrite.php 1369
$search_rewrite = apply_filters( 'search_rewrite_rules', $search_rewrite );

Where the hook is used in WordPress

Usage not found.