钩子文档

get_terms_orderby

💡 云策文档标注

概述

get_terms_orderby 是一个 WordPress 过滤器,用于修改术语查询中的 ORDERBY 子句。它允许开发者在执行术语查询时自定义排序逻辑。

关键要点

  • 过滤器名称:get_terms_orderby
  • 作用:过滤术语查询的 ORDERBY 子句
  • 参数:$orderby(ORDERBY 子句字符串)、$args(术语查询参数数组)、$taxonomies(分类法名称数组)
  • 相关函数:WP_Term_Query::parse_orderby() 用于解析和清理 orderby 参数
  • 引入版本:WordPress 2.8.0

📄 原文内容

Filters the ORDERBY clause of the terms query.

Parameters

$orderbystring
ORDERBY clause of the terms query.
$argsarray
An array of term query arguments.
$taxonomiesstring[]
An array of taxonomy names.

Source

$orderby = apply_filters( 'get_terms_orderby', $orderby, $this->query_vars, $this->query_vars['taxonomy'] );

Changelog

Version Description
2.8.0 Introduced.