Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Site Editor: Fix _wp_file_based term deletion in migration #28300

Merged
merged 3 commits into from
Jan 19, 2021
Merged
Changes from 2 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
9 changes: 6 additions & 3 deletions lib/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,17 @@ function _gutenberg_migrate_remove_fse_drafts() {
}

// Delete _wp_file_based term.
$term = get_term_by( 'name', '_wp_file_based', 'wp-theme' );
$term = get_term_by( 'name', '_wp_file_based', 'wp_theme' );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😅

if ( $term ) {
wp_delete_term( $term->term_id, 'wp-theme' );
wp_delete_term( $term->term_id, 'wp_theme' );
}

// Delete useless options.
delete_option( 'gutenberg_last_synchronize_theme_template_checks' );
delete_option( 'gutenberg_last_synchronize_theme_template-part_checks' );
}

add_action( 'plugins_loaded', '_gutenberg_migrate_database' );
// Deletion of the `_wp_file_based` term (in _gutenberg_migrate_remove_fse_drafts) must happen
// after its taxonomy (`wp_theme`) is registered. This happens in `gutenberg_register_wp_theme_taxonomy`,
// which is hooked into `init` (default priority, i.e. 10).
add_action( 'init', '_gutenberg_migrate_database', 20 );