mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-05 18:32:23 +01:00
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
This commit is contained in:
parent
7ef604c052
commit
b05593c0b9
@ -1568,14 +1568,15 @@ function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previo
|
|||||||
* of adjacency, 'next' or 'previous'.
|
* of adjacency, 'next' or 'previous'.
|
||||||
*
|
*
|
||||||
* @since 2.5.0
|
* @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 string $join The JOIN clause in the SQL.
|
||||||
* @param bool $in_same_term Whether post should be in a same taxonomy term.
|
* @param bool $in_same_term Whether post should be in a same taxonomy term.
|
||||||
* @param array $excluded_terms Array of excluded term IDs.
|
* @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 $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.
|
* 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'.
|
* of adjacency, 'next' or 'previous'.
|
||||||
*
|
*
|
||||||
* @since 2.5.0
|
* @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 string $where The `WHERE` clause in the SQL.
|
||||||
* @param bool $in_same_term Whether post should be in a same taxonomy term.
|
* @param bool $in_same_term Whether post should be in a same taxonomy term.
|
||||||
* @param array $excluded_terms Array of excluded term IDs.
|
* @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 $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.
|
* 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'.
|
* of adjacency, 'next' or 'previous'.
|
||||||
*
|
*
|
||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
|
* @since 4.4.0 Added the `$post` 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.
|
||||||
*/
|
*/
|
||||||
$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 = "SELECT p.ID FROM $wpdb->posts AS p $join $where $sort";
|
||||||
$query_key = 'adjacent_post_' . md5( $query );
|
$query_key = 'adjacent_post_' . md5( $query );
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user