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

Use is_using_gutenberg() wrapper for use_block_editor_for_post(). #1056

Merged
merged 5 commits into from
May 29, 2023

Conversation

peterwilsoncc
Copy link
Collaborator

@peterwilsoncc peterwilsoncc commented May 26, 2023

This ensure against fatal errors in versions of WordPress prior to version 6.1.0. The function is only available within wp-admin in these version of WordPress.

Description of the Change

Use is_using_gutenberg() in place of use_block_editor_for_post() to avoid fatal errors in older versions of WordPress.

Closes #1055

How to test the Change

  1. Install a version of WordPress between 5.7 and 6.0
  2. Activate Distributor
  3. Write a post in the block editor
  4. Attempt to save the post
  5. On this branch the post ought to save, on develop the post will not save.

Changelog Entry

Fixed - Fatal error in WordPress versions 6.0 and earlier.

Credits

Props @peterwilsoncc, @ravinderk

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

This ensure against fatal errors in versions of WordPress prior to version 6.1.0. The function is only available within wp-admin in these version of WordPress.
@peterwilsoncc peterwilsoncc requested a review from a team as a code owner May 26, 2023 02:02
@peterwilsoncc peterwilsoncc requested review from faisal-alvi and removed request for a team May 26, 2023 02:02
@peterwilsoncc peterwilsoncc self-assigned this May 26, 2023
@peterwilsoncc peterwilsoncc requested a review from ravinderk May 26, 2023 02:03
@peterwilsoncc peterwilsoncc added this to the 2.0.0 milestone May 26, 2023
ravinderk
ravinderk previously approved these changes May 26, 2023
Copy link
Contributor

@ravinderk ravinderk left a comment

Choose a reason for hiding this comment

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

@peterwilsoncc it is working as expected.

I want to suggest two minor changes to syndicatable function. This is not a blocker for this pull request.

  • Return bool on line 86
  • If we are accessing global $post then define it at the beginning of the function.

@peterwilsoncc
Copy link
Collaborator Author

@ravinderk I've pushed a couple of commits making those changes. This has dismissed your review so are you able to reapprove?

@ravinderk ravinderk merged commit a746c55 into develop May 29, 2023
@ravinderk ravinderk deleted the fix/1055-syndicate-fatal branch May 29, 2023 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Distributor\PushUI\syndicate() can fatal error in WP < 6.1.0
2 participants