posts_orderby
Filters the ORDER BY clause of the query.
Использование
add_filter( 'posts_orderby', 'wp_kama_posts_orderby_filter', 10, 2 ); /** * Function for `posts_orderby` filter-hook. * * @param string $orderby The ORDER BY clause of the query. * @param WP_Query $query The WP_Query instance (passed by reference). * * @return string */ function wp_kama_posts_orderby_filter( $orderby, $query ){ // filter... return $orderby; }
- $orderby(строка)
- The ORDER BY clause of the query.
- $query(WP_Query)
- The WP_Query instance (passed by reference).
Список изменений
С версии 1.5.1 | Введена. |
Где вызывается хук
posts_orderby
wp-includes/class-wp-query.php 2806
$orderby = apply_filters_ref_array( 'posts_orderby', array( $orderby, &$this ) );