Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions features/site-empty.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
3 changes: 2 additions & 1 deletion src/Site_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment thread
swissspidy marked this conversation as resolved.
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(
Expand Down
Loading