mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
Avoid database error when include
or exclude
is not really a term_id
. Adds more unit tests.
Props kovshenin. Fixes #11823. Built from https://develop.svn.wordpress.org/trunk@25257 git-svn-id: http://core.svn.wordpress.org/trunk@25225 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
bb0761e475
commit
d041c830bc
@ -1310,9 +1310,10 @@ function get_terms($taxonomies, $args = '') {
|
||||
$inclusions = implode( ',', wp_parse_id_list( $include ) );
|
||||
}
|
||||
|
||||
if ( ! empty( $inclusions ) )
|
||||
if ( ! empty( $inclusions ) ) {
|
||||
$inclusions = ' AND t.term_id IN ( ' . $inclusions . ' )';
|
||||
$where .= $inclusions;
|
||||
$where .= $inclusions;
|
||||
}
|
||||
|
||||
$exclusions = '';
|
||||
if ( ! empty( $exclude_tree ) ) {
|
||||
@ -1339,7 +1340,9 @@ function get_terms($taxonomies, $args = '') {
|
||||
$exclusions = ' AND t.term_id NOT IN (' . $exclusions . ')';
|
||||
|
||||
$exclusions = apply_filters( 'list_terms_exclusions', $exclusions, $args );
|
||||
$where .= $exclusions;
|
||||
|
||||
if ( ! empty( $exclusions ) )
|
||||
$where .= $exclusions;
|
||||
|
||||
if ( !empty($slug) ) {
|
||||
$slug = sanitize_title($slug);
|
||||
|
Loading…
Reference in New Issue
Block a user