diff --git a/features/site-empty.feature b/features/site-empty.feature index 4a69027e3..2f0b7adcc 100644 --- a/features/site-empty.feature +++ b/features/site-empty.feature @@ -128,3 +128,14 @@ Feature: Empty a WordPress site of its data When I run `wp --url=example.com/foo post list --format=ids` Then STDOUT should be empty + + @require-wp-6.1 + Scenario: Empty a multisite site without deprecation notices + Given a WP multisite installation + And I run `wp config set WP_DEBUG true --raw` + + When I run `wp site empty --yes` + Then STDERR should not contain: + """ + global_terms_enabled + """ diff --git a/src/Site_Command.php b/src/Site_Command.php index 7c69b4646..e6d56f19c 100644 --- a/src/Site_Command.php +++ b/src/Site_Command.php @@ -118,8 +118,9 @@ private function insert_default_terms() { /* translators: Default category slug */ $cat_slug = sanitize_title( _x( 'Uncategorized', 'Default category slug' ) ); + // global_terms_enabled() is deprecated since WP 6.1, where global terms are always off. // @phpstan-ignore function.deprecated - if ( global_terms_enabled() ) { // phpcs:ignore WordPress.WP.DeprecatedFunctions.global_terms_enabledFound -- Required for backwards compatibility. + if ( Utils\wp_version_compare( '6.1', '<' ) && global_terms_enabled() ) { // phpcs:ignore WordPress.WP.DeprecatedFunctions.global_terms_enabledFound -- Required for backwards compatibility. $cat_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) ); if ( null === $cat_id ) { $wpdb->insert(