Posts, Post Types: Pass the `order` parameter to `get_{$adjacent}_post_sort` filter.

Props manchumahara.
Fixes #41924.

git-svn-id: https://develop.svn.wordpress.org/trunk@41589 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2017-09-24 23:00:08 +00:00
parent b6c4a2309d
commit 5c959aa5d8
1 changed files with 7 additions and 5 deletions

View File

@ -1723,11 +1723,13 @@ function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previo
* *
* @since 2.5.0 * @since 2.5.0
* @since 4.4.0 Added the `$post` parameter. * @since 4.4.0 Added the `$post` parameter.
* @since 4.9.0 Added the `$order` parameter.
* *
* @param string $order_by The `ORDER BY` clause in the SQL. * @param string $order_by The `ORDER BY` clause in the SQL.
* @param WP_Post $post WP_Post object. * @param WP_Post $post WP_Post object.
* @param string $order Sort order. 'DESC' for previous post, 'ASC' for next.
*/ */
$sort = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1", $post ); $sort = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1", $post, $order );
$query = "SELECT p.ID FROM $wpdb->posts AS p $join $where $sort"; $query = "SELECT p.ID FROM $wpdb->posts AS p $join $where $sort";
$query_key = 'adjacent_post_' . md5( $query ); $query_key = 'adjacent_post_' . md5( $query );