Skip to content
This repository was archived by the owner on Feb 20, 2026. It is now read-only.

Avoid core/image PHP warnings#90

Merged
smithjw1 merged 1 commit intoAutomattic:trunkfrom
aatanasovdev:fix/core-image-warning
Apr 14, 2025
Merged

Avoid core/image PHP warnings#90
smithjw1 merged 1 commit intoAutomattic:trunkfrom
aatanasovdev:fix/core-image-warning

Conversation

@aatanasovdev
Copy link
Contributor

@aatanasovdev aatanasovdev commented Apr 12, 2025

Description

Fixing PHP warnings when empty core/image blocks are used inside the WordPress Block editor.

Fixes: #89

Steps to Test

  1. Add an empty core/image to a post (as shown in the below screenshot).
  2. Go to the GraphQL IDE and execute the below example query. Please set a relevant id based on your instance.
  3. Check the debug logs of your instance, and warnings shouldn't appear.
  4. Set an attachment to the empty image block and ensure attributes like originalHeight are available when using the same query (check the attachment attributes screenshot).

Screenshots

core/image

empty-core-image

attachment attributes

attachment-attributes

Example GraphQL Query

query GetPostContentBlocks {
  post(id: 6, idType: DATABASE_ID) {
    contentBlocks {
      blocks {
        tagName
        name
        attributes {
          name
          value
        }
      }
    }
  }
}

@aatanasovdev aatanasovdev requested a review from a team as a code owner April 12, 2025 10:08
Copy link
Member

@chriszarate chriszarate left a comment

Choose a reason for hiding this comment

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

Tested and approved. Thanks for this fix! 👍

@smithjw1 smithjw1 merged commit 84eade7 into Automattic:trunk Apr 14, 2025
2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty core/image blocks cause PHP warnings

4 participants