From 271b1f60cd3e46548bd8aeb198eb8a923b9b3827 Mon Sep 17 00:00:00 2001 From: desrosj Date: Thu, 6 Jan 2022 17:03:05 +0000 Subject: [PATCH] Query: Improve sanitization within `WP_Tax_Query`. Props dd32, xknown, peterwilsoncc, ehtis. Built from https://develop.svn.wordpress.org/trunk@52454 git-svn-id: http://core.svn.wordpress.org/trunk@52046 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-tax-query.php | 6 +++++- wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/wp-includes/class-wp-tax-query.php b/wp-includes/class-wp-tax-query.php index 68b12ffbe4..a7a40cf21f 100644 --- a/wp-includes/class-wp-tax-query.php +++ b/wp-includes/class-wp-tax-query.php @@ -556,7 +556,11 @@ class WP_Tax_Query { return; } - $query['terms'] = array_unique( (array) $query['terms'] ); + if ( 'slug' === $query['field'] || 'name' === $query['field'] ) { + $query['terms'] = array_unique( (array) $query['terms'] ); + } else { + $query['terms'] = wp_parse_id_list( $query['terms'] ); + } if ( is_taxonomy_hierarchical( $query['taxonomy'] ) && $query['include_children'] ) { $this->transform_query( $query, 'term_id' ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 3da73ea9b8..5e9b1f0e50 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.0-alpha-52453'; +$wp_version = '6.0-alpha-52454'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.