#65166 closed enhancement (fixed)
Editor: Hide Classic Block from the inserter
| Reported by: | tyxla | Owned by: | tyxla |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.1 |
| Component: | Editor | Version: | |
| Severity: | normal | Keywords: | has-patch gutenberg-merge has-unit-tests |
| Cc: | Focuses: |
Description
This ticket tracks the backport of PHP files for the following Gutenberg update:
https://github.com/WordPress/gutenberg/pull/77911
We're hiding the Classic block in the block editor inserter by default.
We're also introducing a new wp_classic_block_supports_inserter filter that allows overriding that behavior globally or per post.
See https://github.com/WordPress/gutenberg/pull/77911 for the full context.
Change History (8)
This ticket was mentioned in PR #11712 on WordPress/wordpress-develop by @tyxla.
4 months ago
#1
#2
@
4 months ago
Removing trunk version as this is not going to be shipped with WP 7.0 but in the next releases.
#3
@
4 months ago
- Version trunk
Since this is an enhancement, there's no first version of WordPress this can be reproduced in. Removing trunk version.
I commented on the PR a suggestion, but the current proposed approach feels like a bit much to me.
@tyxla commented on PR #11712:
4 months ago
#4
Hmm, I'm not really fond of this approach.
Is it possible to add a
supports_inserterorshow_in_inserterargument forregister_block_type()/WP_Block_Type_Registry->register()/WP_Blockandregister_block_type_from_metadata()instead?
That would:
- emulate the similar pattern used in
register_post_type()andregister_taxonomy()- eliminating the need for this new function and filter entirely.
- Still allows filtering through
block_type_metadata,register_block_type_args, and other related filters.- Make it easier for custom blocks to also disable the inserter behavior.
The parallel to register_post_type() makes sense, but I don't think introducing supports_inserter as a public registration arg is a better alternative. We'd be adding (and committing to maintain) an API that we don't actually want to recommend for general use (especially considering there is already UI for that). The goal here is to phase the Classic block out, not to give every block a first-class "hide me from the inserter" knob.
A filter feels like the lighter touch: it scopes the escape hatch to this specific deprecation, and we can deprecate the filter itself once the Classic block is fully retired. A registration arg is much harder to walk back from.
This ticket was mentioned in PR #12416 on WordPress/wordpress-develop by @tyxla.
2 months ago
#6
- Keywords has-unit-tests added
## What?
Reverts the Classic block inserter-hiding work introduced in [62546] (#65166).
The Classic (core/freeform) block is once again available in the inserter by default. This removes:
- The
wp_declare_classic_block_necessary()function and itsenqueue_block_editor_assetsaction hook inscript-loader.php/default-filters.php. - The
wp_classic_block_supports_inserterfilter (which never shipped in a WordPress release). - The associated PHPUnit tests in
tests/phpunit/tests/dependencies/scripts.php.
## Why?
The Classic block deprecation / inserter-gating effort is being reverted. The corresponding Gutenberg change is reverted in https://github.com/WordPress/gutenberg/pull/79894. This PR keeps Core in sync by removing the backported PHP side.
Since the wp_classic_block_supports_inserter filter never made it into a WordPress release, it can be removed cleanly.
## How?
This is a straight revert of [62546] — all 100 added lines across three files are removed. No other code referenced the function or filter.
## Testing Instructions
- Open the block editor and open the inserter — the Classic block should be available.
- Confirm the
window.__needsClassicBlockinline script is no longer printed onenqueue_block_editor_assets. - Run the dependencies/scripts test suite — the removed
wp_declare_classic_block_necessarytests should no longer exist and the suite should pass.
See #65166.
🤖 Generated with Claude Code
@tyxla commented on PR #12416:
2 months ago
#8
A commit was made that fixes the Trac ticket referenced in the description of this pull request.
SVN changeset: 62652
GitHub commit: https://github.com/WordPress/wordpress-develop/commit/76f9763f2c6f0a0e26d96e2e54dccf4849342ff7
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Trac ticket: https://core.trac.wordpress.org/ticket/65166
This PR brings the changes from the following Gutenberg PR to core:
https://github.com/WordPress/gutenberg/pull/77911
## Description
We're hiding the Classic block in the block editor inserter by default.
We're also introducing a new
wp_classic_block_supports_inserterfilter that allows overriding that behavior globally or per post.See: WordPress/gutenberg#74242
## Testing
block) and confirm the Classic block renders correctly and is editable.add_filter( 'gutenberg_classic_block_supports_inserter', '__return_true' );. Alternatively, you can use this plugin to test it.