From cd8b13842fb726218581cb34df7212bebffc58a1 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Fri, 16 Oct 2020 02:43:06 +0000 Subject: [PATCH] Taxonomy: Fix warnings thrown by custom term count callbacks. Add a `use` to a closure to avoid an undefined variable throwing a warning. Adds unit tests to ensure the custom callbacks run as expected when defined. Follow up to [49141]. Props ocean90, dd32. Fixes #40351. Built from https://develop.svn.wordpress.org/trunk@49171 git-svn-id: http://core.svn.wordpress.org/trunk@48933 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-taxonomy.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/class-wp-taxonomy.php b/wp-includes/class-wp-taxonomy.php index 21f3d4aec9..daedb66f82 100644 --- a/wp-includes/class-wp-taxonomy.php +++ b/wp-includes/class-wp-taxonomy.php @@ -426,7 +426,7 @@ final class WP_Taxonomy { is_callable( $args['update_count_callback'] ) && empty( $args['update_count_by_callback'] ) ) { - $args['update_count_by_callback'] = function( $tt_ids, $taxonomy, $modify_by ) { + $args['update_count_by_callback'] = function( $tt_ids, $taxonomy ) use ( $args ) { return call_user_func( $args['update_count_callback'], $tt_ids, $taxonomy ); }; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 2a85a6808e..1bec5fdb76 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.6-alpha-49170'; +$wp_version = '5.6-alpha-49171'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.