From f6980a5fd77acc31b7c8d3ebdc8dc8f657a24365 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Thu, 2 Jun 2016 14:38:29 +0000 Subject: [PATCH] Taxonomy: Don't pass results of 'count' query through 'get_terms' filter. Use of the 'get_terms' filter was consolidated in [37572], with the introduction of `WP_Term_Query`. At that time, the result of 'count=true' queries began being filtered by 'get_terms'. This breaks existing 'get_terms' callbacks, which often assume that the returned value will be an array or a `WP_Error` object. Props JustinSainton. Fixes #36992. Built from https://develop.svn.wordpress.org/trunk@37623 git-svn-id: http://core.svn.wordpress.org/trunk@37591 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/taxonomy.php | 5 +++++ wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index f71494244e..534a9de4f1 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -1208,6 +1208,11 @@ function get_terms( $args = array(), $deprecated = '' ) { $terms = $term_query->query( $args ); + // Count queries are not filtered, for legacy reasons. + if ( $term_query->query_vars['count'] ) { + return $terms; + } + /** * Filters the found terms. * diff --git a/wp-includes/version.php b/wp-includes/version.php index 5e2b459875..7d3aa2f505 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.6-alpha-37622'; +$wp_version = '4.6-alpha-37623'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.