Title: post_search_columns
Published: March 29, 2023
Last modified: May 20, 2026

---

# apply_filters( ‘post_search_columns’, string[] $search_columns, string $search, WP_Query $query )

## In this article

 * [Description](https://developer.wordpress.org/reference/hooks/post_search_columns/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/hooks/post_search_columns/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/post_search_columns/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/post_search_columns/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/post_search_columns/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/post_search_columns/?output_format=md#wp--skip-link--target)

Filters the columns to search in a [WP_Query](https://developer.wordpress.org/reference/classes/wp_query/)
search.

## 󠀁[Description](https://developer.wordpress.org/reference/hooks/post_search_columns/?output_format=md#description)󠁿

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

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/post_search_columns/?output_format=md#parameters)󠁿

 `$search_columns`string[]

Array of column names to be searched.

`$search`string

Text being searched.

`$query`[WP_Query](https://developer.wordpress.org/reference/classes/wp_query/)

The current [WP_Query](https://developer.wordpress.org/reference/classes/wp_query/)
instance.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/post_search_columns/?output_format=md#source)󠁿

    ```php
    $search_columns = (array) apply_filters( 'post_search_columns', $search_columns, $query_vars['s'], $this );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-query.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/class-wp-query.php#L1473)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/class-wp-query.php#L1473-L1473)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/post_search_columns/?output_format=md#related)󠁿

| Used by | Description | 
| [WP_Query::parse_search()](https://developer.wordpress.org/reference/classes/wp_query/parse_search/)`wp-includes/class-wp-query.php` |

Generates SQL for the WHERE clause based on passed search terms.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/post_search_columns/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.2.0](https://developer.wordpress.org/reference/since/6.2.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fpost_search_columns%2F)
before being able to contribute a note or feedback.