Filters the ORDER BY clause in the SQL for an adjacent post query.
Description
The dynamic portion of the hook name, $adjacent, refers to the type of adjacency, 'next' or 'previous'. Possible hook names include: <ul> <li>get_next_post_sort</li> <li>get_previous_post_sort</li> </ul>
Parameters
$order_bystring
The ORDER BY clause in the SQL.
$postWP_Post
WP_Post object.
$orderstring
Sort order. 'DESC' for previous post, 'ASC' for next.
1998* @since 4.9.0 Added the `$order` parameter.1999*2000* @param string$order_by The `ORDER BY` clause in the SQL.2001* @param WP_Post$post WP_Post object.2002* @param string$order Sort order.'DESC'for previous post,'ASC'for next.2003*/2004$sort=apply_filters("get_{$adjacent}_post_sort","ORDER BY p.post_date $order LIMIT 1",$post,$order);20052006$query="SELECT p.ID FROM $wpdb->posts AS p $join$where$sort";2007$key=md5($query);2008$last_changed=wp_cache_get_last_changed('posts');2009if($in_same_term||!empty($excluded_terms)){2010$last_changed.=wp_cache_get_last_changed('terms');
History
Introduced in 2.5.0. Unchanged from 6.7.7 through 7.1.0.