Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions php/class-coauthors-plus.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@ public function supported_post_types(): array {
'customize_changeset',
'wp_template',
'wp_template_part',
// Synced patterns gained 'author' support in WordPress 7.2 (core ticket #66307), but bylines do not apply to them.
'wp_block',
);

foreach ( $post_types as $key => $name ) {
Expand Down
23 changes: 23 additions & 0 deletions tests/Integration/Bylines/SupportedPostTypesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,29 @@ public function test_default_supported_post_types(): void {
$this->assertEquals( array_values( $expected ), array_values( $supported_post_types ) );
}

/**
* Synced patterns (wp_block) must not be supported, even when they support 'author'.
*
* WordPress 7.2 adds 'author' support to wp_block (core ticket #66307). Add the
* support here too, so the test covers older WordPress versions as well.
*
* @covers ::supported_post_types
*/
public function test_wp_block_is_not_supported_even_with_author_support(): void {
$had_support = post_type_supports( 'wp_block', 'author' );
add_post_type_support( 'wp_block', 'author' );

try {
$supported_post_types = ( new \CoAuthors_Plus() )->supported_post_types();
} finally {
if ( ! $had_support ) {
remove_post_type_support( 'wp_block', 'author' );
}
}

$this->assertNotContains( 'wp_block', $supported_post_types );
}

/**
* Test whether the supported post types can be filtered.
*
Expand Down
Loading