Skip to content

Commit e0f6cb4

Browse files
committed
fix: run the migration script, old disabled block represents hidden
1 parent 052d5ef commit e0f6cb4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/editor-settings.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ class Stackable_Editor_Settings {
1212
* Add our hooks.
1313
*/
1414
function __construct() {
15+
// Migrate settings.
16+
add_action( 'admin_init', array( $this, 'migrate_block_states' ) );
17+
add_action( 'rest_api_init', array( $this, 'migrate_block_states' ) );
18+
1519
// Register settings.
1620
add_action( 'admin_init', array( $this, 'register_settings' ) );
1721
add_action( 'rest_api_init', array( $this, 'register_settings' ) );
@@ -315,8 +319,8 @@ function migrate_block_states() {
315319

316320
if ( is_array( $old_disabled_blocks ) ) {
317321
foreach ( $old_disabled_blocks as $block_name ) {
318-
// In the block_states, disabled is 1 and hidden is 2
319-
$new_block_states[ $block_name ] = 1;
322+
// In the block_states, hidden is 2 and disabled is 3
323+
$new_block_states[ $block_name ] = 2;
320324
}
321325
}
322326

0 commit comments

Comments
 (0)