site_search_columns
Filters the columns to search in a WP_Site_Query search.
The default columns include 'domain' and 'path.
Usage
add_filter( 'site_search_columns', 'wp_kama_site_search_columns_filter', 10, 3 ); /** * Function for `site_search_columns` filter-hook. * * @param string[] $search_columns Array of column names to be searched. * @param string $search Text being searched. * @param WP_Site_Query $query The current WP_Site_Query instance. * * @return string[] */ function wp_kama_site_search_columns_filter( $search_columns, $search, $query ){ // filter... return $search_columns; }
- $search_columns(string[])
- Array of column names to be searched.
- $search(string)
- Text being searched.
- $query(WP_Site_Query)
- The current WP_Site_Query instance.
Changelog
Since 4.6.0 | Introduced. |
Where the hook is called
site_search_columns
wp-includes/class-wp-site-query.php 627
$search_columns = apply_filters( 'site_search_columns', $search_columns, $this->query_vars['search'], $this );