钩子文档

wp_search_stopwords

💡 云策文档标注

概述

本文档介绍 WordPress 中的 wp_search_stopwords 过滤器,用于在解析搜索词时过滤停用词。开发者可以通过此过滤器自定义停用词列表,以优化搜索查询。

关键要点

  • wp_search_stopwords 是一个过滤器,允许修改解析搜索词时使用的停用词数组。
  • 参数 $stopwords 是一个字符串数组,包含停用词列表。
  • 该过滤器在 WP_Query::get_search_stopwords() 方法中被调用,用于检索停用词。
  • 自 WordPress 3.7.0 版本引入。

📄 原文内容

Filters stopwords used when parsing search terms.

Parameters

$stopwordsstring[]
Array of stopwords.

Source

$this->stopwords = apply_filters( 'wp_search_stopwords', $stopwords );

Changelog

Version Description
3.7.0 Introduced.