posts_orderby
Filters the ORDER BY clause of the query.
Usage
add_filter( 'posts_orderby', 'wp_kama_posts_orderby_filter' );
/**
* Function for `posts_orderby` filter-hook.
*
* @param string $orderby The ORDER BY clause of the query.
*
* @return string
*/
function wp_kama_posts_orderby_filter( $orderby ){
// filter...
return $orderby;
}
- $orderby(string)
- The ORDER BY clause of the query.
Changelog
| Since 1.5.1 | Introduced. |
Where the hook is called
posts_orderby
wp-includes/class-wp-query.php 2967
$orderby = apply_filters_ref_array( 'posts_orderby', array( $orderby, &$this ) );