-
Notifications
You must be signed in to change notification settings - Fork 28
Add WordPress 6.9+ Block Notes compatibility to disable comments feature #190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
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/
There was a problem hiding this 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, withnoteincluded by default - Modified comment filtering logic to preserve allowed comment types while blocking traditional comments
- Added a new filter
tenup_experience_disable_comments_allowed_typesfor 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. |
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
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.
| $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. | ||
| } |
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
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.
|
|
||
| // 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. |
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
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".
# Conflicts: # CHANGELOG.md
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:
note) are now allowed and work as expected even when comments are disabled, both in the editor and on the frontend. [1] [2]Extensibility for allowed comment types:
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:
Documentation updates:
CHANGELOG.mdandREADME.mdto document the Block Notes compatibility, new filter, and related changes. [1] [2] [3]Closes #189