Skip to content

Commit

Permalink
Experimental: Fix TinyMCE removal for heartbeat requests
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla committed Jul 25, 2023
1 parent 3535bb8 commit 2931e45
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/experimental/disable-tinymce.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,15 @@ function gutenberg_post_being_edited_requires_classic_block() {
return false;
}

// Handle the post editor.
if ( ! empty( $_GET['post'] ) && ! empty( $_GET['action'] ) && 'edit' === $_GET['action'] ) {
$current_post = get_post( intval( $_GET['post'] ) );
if ( ! $current_post || is_wp_error( $current_post ) ) {
return false;
}
// Continue only if we're in the post editor.
if ( empty( $_GET['post'] ) || empty( $_GET['action'] ) || 'edit' !== $_GET['action'] ) {
return false;
}

$content = $current_post->post_content;
// Bail if for some reason the post isn't found.
$current_post = get_post( intval( $_GET['post'] ) );
if ( ! $current_post || is_wp_error( $current_post ) ) {
return false;
}

// Check if block editor is disabled by "Classic Editor" or another plugin.
Expand All @@ -79,6 +80,7 @@ function_exists( 'use_block_editor_for_post_type' ) &&
return true;
}

$content = $current_post->post_content;
if ( empty( $content ) ) {
return false;
}
Expand Down

0 comments on commit 2931e45

Please sign in to comment.