Skip to content

Conversation

@fabiankaegy
Copy link
Member

This pull request adds full compatibility with the new WordPress 6.9+ Block Notes feature while the "disable comments" option is enabled. It ensures that Block Notes (which use a different comment type) continue to function for editorial collaboration, even when traditional comments are disabled. Additionally, a new filter allows developers to specify which comment types should bypass the disable comments feature. Several code changes improve how comment queries and the frontend handle these exceptions.

WordPress 6.9+ Block Notes compatibility:

  • Block Notes (comment type note) are now allowed and work as expected even when comments are disabled, both in the editor and on the frontend. [1] [2]
  • Documentation updated to explain Block Notes compatibility and clarify that disabling comments does not affect Block Notes, which are only visible in the editor.

Extensibility for allowed comment types:

  • Added a new filter, tenup_experience_disable_comments_allowed_types, allowing plugins to specify additional comment types that should remain functional when comments are disabled. [1] [2]

Bug fixes and improved filtering:

  • The logic for hiding comments on the frontend and short-circuiting comment queries now properly checks comment types, ensuring only traditional comments are blocked while allowed types (like Block Notes) are preserved.

Documentation updates:

  • Updated CHANGELOG.md and README.md to document the Block Notes compatibility, new filter, and related changes. [1] [2] [3]

Closes #189

When the disable comments feature is enabled, Block Notes (introduced in
WordPress 6.9) now continue to function correctly. Block Notes are stored
as WP_Comments with a comment_type of 'note' and are used for collaborative
feedback within the block editor.

Changes:
- Add get_allowed_comment_types() helper method to centralize allowed types
- Update filter_comments_pre_query() to check comment type before short-circuiting
- Update disable_comments_hide_existing_comments() to preserve Block Notes
- Fix method signatures to match WordPress filter parameter expectations
- Add comprehensive inline documentation with references to WP 6.9 dev notes

New filter:
- tenup_experience_disable_comments_allowed_types: Allows extending the list
  of comment types that bypass the disable comments feature

This ensures editorial teams can use Block Notes for collaboration while
keeping traditional comments disabled for site visitors.

Fixes compatibility with WordPress 6.9+
See: https://make.wordpress.org/core/2025/11/15/notes-feature-in-wordpress-6-9/
@fabiankaegy fabiankaegy requested a review from Copilot December 17, 2025 14:26
@fabiankaegy fabiankaegy self-assigned this Dec 17, 2025
@fabiankaegy fabiankaegy added the bug Something isn't working label Dec 17, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds compatibility for WordPress 6.9+ Block Notes feature with the existing "disable comments" functionality. The implementation ensures that Block Notes (comment type note) continue to work for editorial collaboration even when traditional comments are disabled site-wide.

Key Changes:

  • Introduced a new get_allowed_comment_types() method that returns comment types that should bypass the disable comments feature, with note included by default
  • Modified comment filtering logic to preserve allowed comment types while blocking traditional comments
  • Added a new filter tenup_experience_disable_comments_allowed_types for extensibility

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
includes/classes/Comments/Comments.php Core implementation: adds allowed comment types logic and updates comment query/display filters to preserve Block Notes
README.md Documents the Block Notes compatibility and the new extensibility filter with usage examples
CHANGELOG.md Documents the new feature and bug fixes for the unreleased version

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


#### WordPress 6.9+ Block Notes Compatibility

As of version 1.17.0, the disable comments feature is fully compatible with Block Notes introduced in WordPress 6.9. Block Notes are a collaborative feedback feature that allows teams to leave contextual comments on blocks within the editor.
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

The version number mentioned here (1.17.0) is inconsistent with the @SInCE tags in the code which reference 1.12.0. Please ensure the version number is accurate and consistent across all documentation.

Copilot uses AI. Check for mistakes.
Comment on lines +357 to +362
$comment_type = $query->query_vars['type'] ?? '';

// Allow certain comment types (like Block Notes) to pass through.
if ( in_array( $comment_type, $this->get_allowed_comment_types(), true ) ) {
return $comment_data; // Return null to allow the query to proceed.
}
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

The 'type' parameter in WP_Comment_Query can be either a string or an array of comment types. This code only handles the string case. When 'type' is an array (e.g., ['note', 'comment']), the in_array() check will fail because it's comparing an array against strings. This will incorrectly block queries that include allowed types in an array. Consider checking if $comment_type is an array and using array_intersect() to see if any allowed types are present.

Copilot uses AI. Check for mistakes.

// Allow certain comment types (like Block Notes) to pass through.
if ( in_array( $comment_type, $this->get_allowed_comment_types(), true ) ) {
return $comment_data; // Return null to allow the query to proceed.
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

The inline comment says "Return null to allow the query to proceed" but the code actually returns $comment_data (which is passed as null by default). While functionally correct, it would be clearer to either explicitly return null or update the comment to say "Return $comment_data unchanged to allow the query to proceed".

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Block Notes Compatibility

1 participant