⚡ NEW: WordPress/gutenberg/pull/ - Full Gallery 2025

Skip to content

Conversation

@oandregal

Backported to core at WordPress/wordpress-develop#10648

What?

This PR adds defensive checks to prevent some errors we've seen in hosts.

In certain scenarios, get_post function returns null after the wp_insert_post function is called. Although the post is saved, it's assumed that it can be immediately accessed, which is not always true.

Why?

See #70161

How?

Check if it's an object before passing it to get_object_vars.

How to reproduce

Unfortunately, there's no steps to reproduce it consistently. We've just seen reports by hosts that this happens occassionally in certain transition states for the site (creation, migration, etc.).

@oandregal oandregal self-assigned this Dec 19, 2025
@github-actions

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: oandregal <[email protected]>
Co-authored-by: mcsf <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@oandregal oandregal added [Type] Bug An existing feature does not function as intended Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json labels Dec 19, 2025
mcsf

Choose a reason for hiding this comment

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

Thanks for this

This was referenced Dec 19, 2025
@oandregal oandregal enabled auto-merge (squash) December 19, 2025 13:57
@oandregal oandregal changed the title Defensively cover against situations where the post is null Theme_JSON_Resolver: defensively cover against situations where the post is null Dec 19, 2025
@oandregal oandregal merged commit 14b4649 into trunk Dec 19, 2025
36 checks passed
@oandregal oandregal deleted the fix/null-query-gs branch December 19, 2025 14:29
@github-actions github-actions bot mentioned this pull request Dec 19, 2025
@github-actions github-actions bot added this to the Gutenberg 22.4 milestone Dec 19, 2025
@oandregal oandregal mentioned this pull request Dec 22, 2025
@oandregal

The core PR received feedback, so #74172 brings the changes from core.

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

Labels

Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants