Improve post-filter sanitization of excluded terms in get_adjacent_post().

See [36078], #35211.

git-svn-id: https://develop.svn.wordpress.org/trunk@36079 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges 2015-12-23 20:14:12 +00:00
parent fff6412f91
commit 9c2d3a7a4d

View File

@ -1614,7 +1614,7 @@ function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previo
$excluded_terms = apply_filters( "get_{$adjacent}_post_excluded_terms", $excluded_terms ); $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( $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 ) ) . ') )';
} }
} }