mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-05 07:07:04 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@49171 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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 );
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user