Skip to content

Conversation

@pfefferle
Copy link
Owner

Summary

  • Return null early if meta is undefined, which happens when the custom post type doesn't support custom-fields
  • Add fallback to false for the checkbox checked values to handle undefined meta properties

Test plan

  • Create a custom post type without custom-fields support but with webmentions support
  • Verify no error banner appears in the block editor
  • Verify the Webmentions panel doesn't render (since meta is unavailable)

Fixes #529

Return null early if meta is undefined, which happens when the custom
post type doesn't support 'custom-fields'. Also add fallback to false
for the checkbox checked values to handle undefined meta properties.

Fixes #529
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an error that occurs when the Webmentions editor plugin is used with custom post types (CPTs) that don't support custom-fields. When a CPT lacks this support, the meta property becomes undefined, causing runtime errors in the block editor.

Key Changes:

  • Added an early return when meta is undefined to prevent errors
  • Added || false fallback values to checkbox checked properties (though these are redundant given the early return)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/editor-plugin/plugin.js Adds early return check for undefined meta and fallback values for checkbox properties to prevent errors on CPTs without custom-fields support
readme.md Documents the bug fix in the 5.5.1 changelog entry

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Editor plugin doesn't render when creating a new post of a custom post type

2 participants