-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Experimental: Fix TinyMCE removal for heartbeat requests #52935
Conversation
This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress. If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged. If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack. Thank you! ❤️ View changed files❔ lib/experimental/disable-tinymce.php |
c3adc45
to
2931e45
Compare
Flaky tests detected in 2931e45. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5657072477
|
This PR removes PHP warnings that had appeared in the background (that I mention at #52936 (comment)) but... The classic block appears in the block inserter and I can insert a classic block, add some text content and save a new post, even with the post type of post. |
Odd, I'm unable to reproduce. Is there a chance you checked this PR out and didn't trigger a fresh Gutenberg build? I wonder if we can get a second opinion since I really want to land this and resolve the PHP warnings that are appearing and blocking testing of the rest of the PRs that address #52811. |
I should've checked this PR before filing my own 😅 Going to test it now. |
lib/experimental/disable-tinymce.php
Outdated
$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 ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove the is_wp_error
check here. See https://developer.wordpress.org/reference/functions/get_post/#return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was almost sure that WP_Post
could return a WP_Error
, but I must have misremembered! Anyway, you're right, fixed in 6bb68ee
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm 👍
Post IDs are supposed to be non-negative integers. Co-authored-by: George Mamadashvili <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolves the issue with PHP warnings.
I'm also unable to reproduce the inserter behavior that @skorasaurus reported. The Classic block isn't available in the inserter for me.
Thank you both 🙌 Will ship ASAP to resolve the warnings. |
Warning: Type of PR label error To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. |
What?
This PR fixes warnings that are thrown for heartbeat requests when the TinyMCE removal experiment is turned on.
The warnings are easy to see in your browser console if you have the Query Monitor plugin installed.
Why?
We're just fixing some warnings:
Found while working on #52811.
How?
We're moving the
$current_post
declaration outside the condition that declares it and moving the condition above. That way, the code that uses$current_post
will actually be reached only when necessary.Testing Instructions
Testing Instructions for Keyboard
None.
Screenshots or screencast
None.