1. 首页
  2. WordPress 函数手册

get_search_query()

get_search_query( bool $escaped = true )

检索搜索WordPress查询变量的内容。
Retrieves the contents of the search WordPress query variable.

目录锚点:#说明#参数#返回#源码#笔记


说明(Description)

搜索查询字符串通过esc_attr()传递,以确保可以安全地放置在html属性中。


参数(Parameters)

参数 类型 必填 说明
$escaped (bool) 可选 结果是否被转义。只有当你以后逃离它时才使用。不要使用未美化的。

返回(Return)

(string)


源码(Source)


更新版本 源码位置 使用 被使用
2.3.0 wp-includes/general-template.php:3896 5 4

笔记(Notes)

不同的使用方法

get_search_query() 为WP2原创文章,链接:https://www.wp2.cn/functions/get_search_query/