get_terms_orderby
Filter HookDescription
Filters the ORDERBY clause of the terms query.Hook Information
File Location |
wp-includes/class-wp-term-query.php
View on GitHub
|
Hook Type | Filter |
Line Number | 954 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$orderby
|
`ORDERBY` clause of the terms query. |
array
|
$args
|
An array of term query arguments. |
string[]
|
$taxonomies
|
An array of taxonomy names. |
Usage Examples
Basic Usage
<?php
// Hook into get_terms_orderby
add_filter('get_terms_orderby', 'my_custom_filter', 10, 3);
function my_custom_filter($orderby, $args, $taxonomies) {
// Your custom filtering logic here
return $orderby;
}
Source Code Context
wp-includes/class-wp-term-query.php:954
- How this hook is used in WordPress core
<?php
949 *
950 * @param string $orderby `ORDERBY` clause of the terms query.
951 * @param array $args An array of term query arguments.
952 * @param string[] $taxonomies An array of taxonomy names.
953 */
954 $orderby = apply_filters( 'get_terms_orderby', $orderby, $this->query_vars, $this->query_vars['taxonomy'] );
955
956 // Run after the 'get_terms_orderby' filter for backward compatibility.
957 if ( $maybe_orderby_meta ) {
958 $maybe_orderby_meta = $this->parse_orderby_meta( $_orderby );
959 if ( $maybe_orderby_meta ) {
PHP Documentation
<?php
/**
* Filters the ORDERBY clause of the terms query.
*
* @since 2.8.0
*
* @param string $orderby `ORDERBY` clause of the terms query.
* @param array $args An array of term query arguments.
* @param string[] $taxonomies An array of taxonomy names.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/class-wp-term-query.php
Related Hooks
Related hooks will be displayed here in future updates.