Make WordPress Core


Ignore:
Timestamp:
09/24/2017 11:00:08 PM (7 years ago)
Author:
SergeyBiryukov
Message:

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

Props manchumahara.
Fixes #41924.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/link-template.php

    r41584 r41589  
    17081708     * @since 4.4.0 Added the `$taxonomy` and `$post` parameters.
    17091709     *
    1710      * @param string $where          The `WHERE` clause in the SQL.
    1711      * @param bool   $in_same_term   Whether post should be in a same taxonomy term.
    1712      * @param array  $excluded_terms Array of excluded term IDs.
    1713      * @param string $taxonomy       Taxonomy. Used to identify the term used when `$in_same_term` is true.
     1710     * @param string  $where          The `WHERE` clause in the SQL.
     1711     * @param bool    $in_same_term   Whether post should be in a same taxonomy term.
     1712     * @param array   $excluded_terms Array of excluded term IDs.
     1713     * @param string  $taxonomy       Taxonomy. Used to identify the term used when `$in_same_term` is true.
    17141714     * @param WP_Post $post           WP_Post object.
    17151715     */
     
    17241724     * @since 2.5.0
    17251725     * @since 4.4.0 Added the `$post` parameter.
     1726     * @since 4.9.0 Added the `$order` parameter.
    17261727     *
    17271728     * @param string $order_by The `ORDER BY` clause in the SQL.
    17281729     * @param WP_Post $post    WP_Post object.
    1729      */
    1730     $sort  = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1", $post );
     1730     * @param string  $order   Sort order. 'DESC' for previous post, 'ASC' for next.
     1731     */
     1732    $sort  = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1", $post, $order );
    17311733
    17321734    $query = "SELECT p.ID FROM $wpdb->posts AS p $join $where $sort";
Note: See TracChangeset for help on using the changeset viewer.