WC_Admin_List_Table_Products::get_search_stopwords
Retrieve stopwords used when parsing product search terms.
Метод класса: WC_Admin_List_Table_Products{}
Хуки из метода
Возвращает
string[].
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_search_stopwords();
Код WC_Admin_List_Table_Products::get_search_stopwords() WC Admin List Table Products::get search stopwords WC 11.2.2
private function get_search_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.
$stopwords = array_map(
'wc_strtolower',
array_map(
'trim',
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',
'woocommerce'
)
)
)
);
/** This filter is documented in wp-includes/class-wp-query.php. */
$filtered_stopwords = apply_filters( 'wp_search_stopwords', $stopwords ); // phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingSinceComment -- The hook is documented by WordPress.
// A callback can return anything; keep only strings so the strict in_array() below stays safe.
return is_array( $filtered_stopwords ) ? array_filter( $filtered_stopwords, 'is_string' ) : $stopwords;
}