Skip to content

Keep synced patterns (wp_block) out of supported post types - #1481

Open
faisalahammad wants to merge 1 commit into
Automattic:developfrom
faisalahammad:fix/exclude-wp-block-post-type
Open

faisalahammad wants to merge 1 commit into
Automattic:developfrom
faisalahammad:fix/exclude-wp-block-post-type

Conversation

@faisalahammad

Copy link
Copy Markdown
Contributor

Description

WordPress trunk (7.2-alpha) added author support to the core wp_block post type in changeset 64499 (https://core.trac.wordpress.org/ticket/66307, WordPress/wordpress-develop@1f935706e9, synced from WordPress/gutenberg#84680).

CoAuthors_Plus::supported_post_types() picks every post type that supports author, so on trunk it now returns post, page, wp_block. Because of this:

  • the author taxonomy is registered on patterns,
  • remove_author_link() removes the new core author control from the pattern REST response,
  • SupportedPostTypesTest::test_default_supported_post_types and test_can_filter_supported_post_types fail in the "WP master on PHP latest" CI job.

The plugin already skips wp_block in the co-authors REST endpoint (request_is_for_wp_block_post_type(), is_pattern_sync_operation()), so co-authors were never meant for patterns. This PR adds wp_block to $excluded_built_in, so behaviour is the same as on older WordPress. Sites that want it can still add wp_block with the coauthors_supported_post_types filter.

A new test adds author support to wp_block before the check, so it covers stable WordPress too.

Deploy Notes

None.

Steps to Test

  1. Run composer test:integration (or the integration suite in wp-env) on WP stable: all SupportedPostTypesTest tests pass.
  2. Run the same on WP trunk: test_default_supported_post_types and test_can_filter_supported_post_types pass again.
  3. On a WP trunk site, open Appearance > Editor > Patterns and edit a synced pattern: the core Author control shows, and no Co-Authors panel is added.

Verified locally: SupportedPostTypesTest 7/7 OK on WP 7.1.3 (new test fails without the fix). Full integration suite: 387 tests, only the 2 ms-required multisite tests error, same as on develop in single-site mode. PHPCS: test file clean; class-coauthors-plus.php has 207 existing errors, 208 before (no new ones).

WordPress trunk (7.2-alpha, changeset 64499, core ticket #66307) added
'author' support to the wp_block post type. supported_post_types() picks
every post type that supports 'author', so wp_block was now treated as a
co-authors post type. This registered the author taxonomy on patterns,
removed the core author control from the pattern REST response, and made
the SupportedPostTypesTest tests fail on WP trunk.

Add wp_block to the list of excluded built-in post types, so the behaviour
is the same as on older WordPress. Sites that want co-authors on patterns
can still add it with the coauthors_supported_post_types filter.

Add a test that adds 'author' support to wp_block, so it covers stable WP
versions too.
@faisalahammad
faisalahammad requested a review from a team as a code owner October 19, 2026 22:01
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.

1 participant