Title: WP_Query::get_search_stopwords
Published: April 25, 2014
Last modified: August 20, 2026

---

# WP_Query::get_search_stopwords(): string[]

## In this article

 * [Return](https://developer.wordpress.org/reference/classes/wp_query/get_search_stopwords/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_query/get_search_stopwords/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/classes/wp_query/get_search_stopwords/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/classes/wp_query/get_search_stopwords/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_query/get_search_stopwords/?output_format=md#changelog)

Retrieves stopwords used when parsing search terms.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_query/get_search_stopwords/?output_format=md#return)󠁿

 string[] Stopwords.

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

    ```php
    protected function get_search_stopwords() {
    	if ( isset( $this->stopwords ) ) {
    		return $this->stopwords;
    	}

    	/*
    	 * translators: This is a comma-separated list of very common words that should be excluded from a search,
    	 * like a, an, and the. These are usually called "stopwords". You should not simply translate these individual
    	 * words into your language. Instead, look for and provide commonly accepted stopwords in your language.
    	 */
    	$words = explode(
    		',',
    		_x(
    			'about,an,are,as,at,be,by,com,for,from,how,in,is,it,of,on,or,that,the,this,to,was,what,when,where,who,will,with,www',
    			'Comma-separated list of search stopwords in your language'
    		)
    	);

    	$stopwords = array();
    	foreach ( $words as $word ) {
    		$word = trim( $word, "\r\n\t " );
    		if ( $word ) {
    			$stopwords[] = $word;
    		}
    	}

    	/**
    	 * Filters stopwords used when parsing search terms.
    	 *
    	 * @since 3.7.0
    	 *
    	 * @param string[] $stopwords Array of stopwords.
    	 */
    	$this->stopwords = apply_filters( 'wp_search_stopwords', $stopwords );
    	return $this->stopwords;
    }
    ```

[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.1/src/wp-includes/class-wp-query.php#L1592)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/class-wp-query.php#L1592-L1627)

## 󠀁[Hooks](https://developer.wordpress.org/reference/classes/wp_query/get_search_stopwords/?output_format=md#hooks)󠁿

 [apply_filters( ‘wp_search_stopwords’, string[] $stopwords )](https://developer.wordpress.org/reference/hooks/wp_search_stopwords/)

Filters stopwords used when parsing search terms.

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

| Uses | Description | 
| [_x()](https://developer.wordpress.org/reference/functions/_x/)`wp-includes/l10n.php` |

Retrieves translated string with gettext context.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

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

Checks if the terms are suitable for searching.

  |

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

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

## User Contributed Notes

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