Link Template: Apply `get_{$adjacent}_post_excluded_terms` filter to an empty `excluded_terms` parameter as well.
Props soulseekah, zottto. Fixes #43521. Built from https://develop.svn.wordpress.org/trunk@42828 git-svn-id: http://core.svn.wordpress.org/trunk@42658 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4848a09b35
commit
81500e50ef
|
@ -1682,6 +1682,18 @@ function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previo
|
||||||
$where = '';
|
$where = '';
|
||||||
$adjacent = $previous ? 'previous' : 'next';
|
$adjacent = $previous ? 'previous' : 'next';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filters the IDs of terms excluded from adjacent post queries.
|
||||||
|
*
|
||||||
|
* The dynamic portion of the hook name, `$adjacent`, refers to the type
|
||||||
|
* of adjacency, 'next' or 'previous'.
|
||||||
|
*
|
||||||
|
* @since 4.4.0
|
||||||
|
*
|
||||||
|
* @param string $excluded_terms Array of excluded term IDs.
|
||||||
|
*/
|
||||||
|
$excluded_terms = apply_filters( "get_{$adjacent}_post_excluded_terms", $excluded_terms );
|
||||||
|
|
||||||
if ( $in_same_term || ! empty( $excluded_terms ) ) {
|
if ( $in_same_term || ! empty( $excluded_terms ) ) {
|
||||||
if ( ! empty( $excluded_terms ) && ! is_array( $excluded_terms ) ) {
|
if ( ! empty( $excluded_terms ) && ! is_array( $excluded_terms ) ) {
|
||||||
// back-compat, $excluded_terms used to be $excluded_terms with IDs separated by " and "
|
// back-compat, $excluded_terms used to be $excluded_terms with IDs separated by " and "
|
||||||
|
@ -1715,18 +1727,6 @@ function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previo
|
||||||
$where .= ' AND tt.term_id IN (' . implode( ',', $term_array ) . ')';
|
$where .= ' AND tt.term_id IN (' . implode( ',', $term_array ) . ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Filters the IDs of terms excluded from adjacent post queries.
|
|
||||||
*
|
|
||||||
* The dynamic portion of the hook name, `$adjacent`, refers to the type
|
|
||||||
* of adjacency, 'next' or 'previous'.
|
|
||||||
*
|
|
||||||
* @since 4.4.0
|
|
||||||
*
|
|
||||||
* @param string $excluded_terms Array of excluded term IDs.
|
|
||||||
*/
|
|
||||||
$excluded_terms = apply_filters( "get_{$adjacent}_post_excluded_terms", $excluded_terms );
|
|
||||||
|
|
||||||
if ( ! empty( $excluded_terms ) ) {
|
if ( ! empty( $excluded_terms ) ) {
|
||||||
$where .= " AND p.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships tr LEFT JOIN $wpdb->term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) WHERE tt.term_id IN (" . implode( ',', array_map( 'intval', $excluded_terms ) ) . ') )';
|
$where .= " AND p.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships tr LEFT JOIN $wpdb->term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) WHERE tt.term_id IN (" . implode( ',', array_map( 'intval', $excluded_terms ) ) . ') )';
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.0-alpha-42827';
|
$wp_version = '5.0-alpha-42828';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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