From b05593c0b971cf5dc10b7834bcddbee8b9dfc8e8 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Wed, 9 Sep 2015 03:49:24 +0000 Subject: [PATCH] Add a parameter, `$post`, to `get_{$adjacent}_post_join`, `get_{$adjacent}_post_where`, and `get_{$adjacent}_post_sort` Props JustinSainton. Fixes #24597. Built from https://develop.svn.wordpress.org/trunk@33968 git-svn-id: http://core.svn.wordpress.org/trunk@33937 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/link-template.php | 22 +++++++++++++--------- wp-includes/version.php | 2 +- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index dac08903b5..7b075f017b 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -1568,14 +1568,15 @@ function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previo * of adjacency, 'next' or 'previous'. * * @since 2.5.0 - * @since 4.4.0 Added the `$taxonomy` parameter. + * @since 4.4.0 Added the `$taxonomy` and `$post` parameters. * - * @param string $join The JOIN clause in the SQL. - * @param bool $in_same_term Whether post should be in a same taxonomy term. - * @param array $excluded_terms Array of excluded term IDs. - * @param string $taxonomy Taxonomy. Used to identify the term used when `$in_same_term` is true. + * @param string $join The JOIN clause in the SQL. + * @param bool $in_same_term Whether post should be in a same taxonomy term. + * @param array $excluded_terms Array of excluded term IDs. + * @param string $taxonomy Taxonomy. Used to identify the term used when `$in_same_term` is true. + * @param WP_Post $post WP_Post object. */ - $join = apply_filters( "get_{$adjacent}_post_join", $join, $in_same_term, $excluded_terms, $taxonomy ); + $join = apply_filters( "get_{$adjacent}_post_join", $join, $in_same_term, $excluded_terms, $taxonomy, $post ); /** * Filter the WHERE clause in the SQL for an adjacent post query. @@ -1584,14 +1585,15 @@ function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previo * of adjacency, 'next' or 'previous'. * * @since 2.5.0 - * @since 4.4.0 Added the `$taxonomy` parameter. + * @since 4.4.0 Added the `$taxonomy` and `$post` parameters. * * @param string $where The `WHERE` clause in the SQL. * @param bool $in_same_term Whether post should be in a same taxonomy term. * @param array $excluded_terms Array of excluded term IDs. * @param string $taxonomy Taxonomy. Used to identify the term used when `$in_same_term` is true. + * @param WP_Post $post WP_Post object. */ - $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 ); + $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 ); /** * Filter the ORDER BY clause in the SQL for an adjacent post query. @@ -1600,10 +1602,12 @@ function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previo * of adjacency, 'next' or 'previous'. * * @since 2.5.0 + * @since 4.4.0 Added the `$post` parameter. * * @param string $order_by The `ORDER BY` clause in the SQL. + * @param WP_Post $post WP_Post object. */ - $sort = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1" ); + $sort = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1", $post ); $query = "SELECT p.ID FROM $wpdb->posts AS p $join $where $sort"; $query_key = 'adjacent_post_' . md5( $query ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 733c97a538..0b0f60e50a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-33967'; +$wp_version = '4.4-alpha-33968'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.