wppaste
WordPress

apply_filters( 'post_search_columns', string[] $search_columns, string $search, WP_Query $query )

Since
6.2.0
Filters the columns to search in a WP_Query search.

Description

The supported columns are post_title, post_excerpt and post_content.
They are all included by default.

Compatibility

WordPress
since 6.2.0
  • 6.7.10
  • 6.8.11
  • 6.9.10
  • 7.0.7
  • 7.1.3

Present in every tracked release (6.7.10 to 7.1.3).

Parameters

$search_columnsstring[]
Array of column names to be searched.
$queryWP_Query
The current WP_Query instance.

Where this hook fires · 1

  • wp-includes/class-wp-query.php:1444WP_Query::parse_search()

Source code

		 * @since 6.2.0		 *		 * @param string[] $search_columns Array of column names to be searched.		 * @param string   $search         Text being searched.		 * @param WP_Query $query          The current WP_Query instance.		 */		$search_columns = (array) apply_filters( 'post_search_columns', $search_columns, $q['s'], $this ); 		// Use only supported search columns.		$search_columns = array_intersect( $search_columns, $default_search_columns );		if ( empty( $search_columns ) ) {			$search_columns = $default_search_columns;		}

Changelog

Introduced in 6.2.0. Unchanged from 6.7.10 through 7.1.3.

  1. 6.7.10
  2. 6.8.11
  3. 6.9.10
  4. 7.0.7
  5. 7.1.3

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.7.10 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.