site_search_columns

Filters the columns to search in a WP_Site_Query search.

Description

apply_filters( 'site_search_columns', (array) $search_columns, (string) $this_query_vars_search, (WP_Site_Query) $instance ); 

The default columns include domain and 'path.

Parameters (3)

0. $search_columns (array)
Array of column names to be searched.
1. $this_query_vars_search (string)
The this query vars search.
2. $instance (WP_Site_Query)
The current WP_Site_Query instance.

Usage

To run the hook, copy the example below.
  1. $search_columns = apply_filters( 'site_search_columns', $search_columns, $this_query_vars_search, $instance ); 
  2.  
  3. if ( !empty( $search_columns ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the site_search_columns callback 
  2. function filter_site_search_columns( $search_columns, $this_query_vars_search, $instance ) { 
  3. // make filter magic happen here... 
  4. return $search_columns
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'site_search_columns', 'filter_site_search_columns', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'site_search_columns', 'filter_site_search_columns', 10, 3 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-includes/class-wp-site-query.php  
  1. $search_columns = apply_filters( 'site_search_columns', $search_columns, $this->query_vars['search'], $this );