Skip to content

Classic Block: Use get_post() in wp_declare_classic_block_necessary#78613

Merged
tyxla merged 2 commits into
trunkfrom
update/classic-block-supports-inserter-filter
May 25, 2026
Merged

Classic Block: Use get_post() in wp_declare_classic_block_necessary#78613
tyxla merged 2 commits into
trunkfrom
update/classic-block-supports-inserter-filter

Conversation

@tyxla
Copy link
Copy Markdown
Member

@tyxla tyxla commented May 24, 2026

What

Small cleanup to wp_declare_classic_block_necessary() in the WordPress 7.1 compat layer:

  • Replaces global $post; with get_post().
  • Adds a : void return type.
  • Refreshes the function docblock (description + @since 7.1.0).

Why

Aligns this Gutenberg implementation with the version proposed in the corresponding Core PR (wordpress-develop#11712) so the two stay in sync.

No behavior change.

Testing instructions

  1. Start writing a new post.
  2. Verify you don't see the Classic block in the inserter.
  3. Open an existing post that contains a classic block (or a <!-- wp:freeform --> block) and confirm the Classic block renders correctly and is editable.
  4. Add add_filter( 'wp_classic_block_supports_inserter', '__return_true' ); (or use this plugin) and verify the Classic block appears in the inserter.

🤖 Generated with Claude Code

…ic_block_necessary

Aligns the Gutenberg implementation with the Core PR by removing the
`global $post;` indirection in favor of `get_post()`, adding a `: void`
return type, and refreshing the function docblock.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@tyxla tyxla requested a review from spacedmonkey as a code owner May 24, 2026 15:11
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 24, 2026

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: tyxla <tyxla@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>

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

@tyxla tyxla added the [Type] Enhancement A suggestion for improvement. label May 24, 2026
@tyxla tyxla self-assigned this May 24, 2026
@tyxla tyxla requested a review from yuliyan May 24, 2026 15:15
@tyxla tyxla changed the title Classic Block: Use get_post() in wp_declare_classic_block_necessary Classic Block: Use get_post() in wp_declare_classic_block_necessary May 24, 2026
@tyxla tyxla added [Block] Classic Affects the Classic Editor Block [Type] Experimental Experimental feature or API. and removed [Type] Enhancement A suggestion for improvement. labels May 24, 2026
@github-actions
Copy link
Copy Markdown

Flaky tests detected in 12d38a8.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/26365060051
📝 Reported issues:

Copy link
Copy Markdown
Member

@Mamaduka Mamaduka left a comment

Choose a reason for hiding this comment

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

Thanks for syncing changes!

@tyxla tyxla merged commit b40cdad into trunk May 25, 2026
53 checks passed
@tyxla tyxla deleted the update/classic-block-supports-inserter-filter branch May 25, 2026 09:18
@github-actions github-actions Bot added this to the Gutenberg 23.3 milestone May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Classic Affects the Classic Editor Block [Type] Experimental Experimental feature or API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants