networks_clauses
云策文档标注
概述
networks_clauses 是一个 WordPress 过滤器,用于修改网络查询的 SQL 子句。它允许开发者在执行 WP_Network_Query 时自定义查询结构。
关键要点
- 过滤器名称:networks_clauses
- 参数:$clauses(关联数组,包含查询子句如 SELECT、JOIN、WHERE 等)和 $query(WP_Network_Query 实例,引用传递)
- 用途:主要用于 WP_Network_Query::get_network_ids() 内部,以获取匹配查询变量的网络 ID 列表
- 引入版本:WordPress 4.6.0
原文内容
Filters the network query clauses.
Parameters
$clausesstring[]-
Associative array of the clauses for the query.
fieldsstringThe SELECT clause of the query.joinstringThe JOIN clause of the query.wherestringThe WHERE clause of the query.orderbystringThe ORDER BY clause of the query.limitsstringThe LIMIT clause of the query.groupbystringThe GROUP BY clause of the query.
$queryWP_Network_Query-
Current instance of WP_Network_Query (passed by reference).
Source
$clauses = apply_filters_ref_array( 'networks_clauses', array( compact( $pieces ), &$this ) );
Changelog
| Version | Description |
|---|---|
| 4.6.0 | Introduced. |