Make WordPress Core


Ignore:
Timestamp:
09/09/2015 03:49:00 AM (11 years ago)
Author:
wonderboymusic
Message:

Add a parameter, $post, to get_{$adjacent}_post_join, get_{$adjacent}_post_where, and get_{$adjacent}_post_sort

Props JustinSainton.
Fixes #24597.

File:
1 edited

Legend:

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

    r33963 r33968  
    15691569         *
    15701570         * @since 2.5.0
    1571          * @since 4.4.0 Added the `$taxonomy` parameter.
    1572          *
    1573          * @param string $join           The JOIN clause in the SQL.
    1574          * @param bool   $in_same_term   Whether post should be in a same taxonomy term.
    1575          * @param array  $excluded_terms Array of excluded term IDs.
    1576          * @param string $taxonomy       Taxonomy. Used to identify the term used when `$in_same_term` is true.
    1577          */
    1578         $join = apply_filters( "get_{$adjacent}_post_join", $join, $in_same_term, $excluded_terms, $taxonomy );
     1571         * @since 4.4.0 Added the `$taxonomy` and `$post` parameters.
     1572         *
     1573         * @param string  $join           The JOIN clause in the SQL.
     1574         * @param bool    $in_same_term   Whether post should be in a same taxonomy term.
     1575         * @param array   $excluded_terms Array of excluded term IDs.
     1576         * @param string  $taxonomy       Taxonomy. Used to identify the term used when `$in_same_term` is true.
     1577         * @param WP_Post $post           WP_Post object.
     1578         */
     1579        $join = apply_filters( "get_{$adjacent}_post_join", $join, $in_same_term, $excluded_terms, $taxonomy, $post );
    15791580
    15801581        /**
    … …  
    15851586         *
    15861587         * @since 2.5.0
    1587          * @since 4.4.0 Added the `$taxonomy` parameter.
     1588         * @since 4.4.0 Added the `$taxonomy` and `$post` parameters.
    15881589         *
    15891590         * @param string $where          The `WHERE` clause in the SQL.
    … …  
    15911592         * @param array  $excluded_terms Array of excluded term IDs.
    15921593         * @param string $taxonomy       Taxonomy. Used to identify the term used when `$in_same_term` is true.
    1593          */
    1594         $where = apply_filters( "get_{$adjacent}_post_where", $wpdb->prepare( "WHERE p.post_date $op %s AND p.post_type = %s $where", $current_post_date, $post->post_type ), $in_same_term, $excluded_terms, $taxonomy );
     1594         * @param WP_Post $post           WP_Post object.
     1595         */
     1596        $where = apply_filters( "get_{$adjacent}_post_where", $wpdb->prepare( "WHERE p.post_date $op %s AND p.post_type = %s $where", $current_post_date, $post->post_type ), $in_same_term, $excluded_terms, $taxonomy, $post );
    15951597
    15961598        /**
    … …  
    16011603         *
    16021604         * @since 2.5.0
     1605         * @since 4.4.0 Added the `$post` parameter.
    16031606         *
    16041607         * @param string $order_by The `ORDER BY` clause in the SQL.
    1605          */
    1606         $sort  = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1" );
     1608         * @param WP_Post $post    WP_Post object.
     1609         */
     1610        $sort  = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1", $post );
    16071611
    16081612        $query = "SELECT p.ID FROM $wpdb->posts AS p $join $where $sort";
Note: See TracChangeset for help on using the changeset viewer.