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:
Scott Taylor 2013-09-05 17:15:09 +00:00
parent bb0761e475
commit d041c830bc

View File

@ -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);