Skip to content

Commit 66bef6f

Browse files
committed
only check classic-editor meta when classic editor is activated
1 parent 4e9ee4b commit 66bef6f

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

includes/class-llms-blocks-migrate.php

+19-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,24 @@ public function __construct() {
2727

2828
}
2929

30+
/**
31+
* Determine if a post has been successfully migrated to the block editor.
32+
* @param int $post_id WP_Post ID
33+
* @return bool
34+
* @since 1.1.1
35+
* @version 1.1.1
36+
*/
37+
private function is_post_migrated( $post_id ) {
38+
39+
// Classic editor is being used for this post.
40+
if ( class_exists( 'Classic_Editor' ) && 'classic-editor' === get_post_meta( $post_id, 'classic-editor-remember', true ) ) {
41+
return false;
42+
}
43+
44+
return llms_parse_bool( get_post_meta( get_the_ID(), '_llms_blocks_migrated', true ) );
45+
46+
}
47+
3048
/**
3149
* Retrieve the block template by post type.
3250
*
@@ -143,7 +161,7 @@ public function migrate_post() {
143161
*/
144162
public function remove_template_hooks() {
145163

146-
if ( ! llms_parse_bool( get_post_meta( get_the_ID(), '_llms_blocks_migrated', true ) ) || 'classic-editor' === get_post_meta( get_the_ID(), 'classic-editor-remember', true ) ) {
164+
if ( ! $this->is_post_migrated( get_the_ID() ) ) {
147165
return;
148166
}
149167

0 commit comments

Comments
 (0)