WordPress 6.9 introduces Block Notes, a collaborative feedback feature stored as WP_Comments with comment_type of note. The current disable comments implementation blocks all comment queries unconditionally, which will break Notes functionality.
Conflict Analysis
| Filter/Hook |
Current Behavior |
Impact on Notes |
Fix Required |
comments_pre_query |
Returns empty array for ALL queries |
CRITICAL: Blocks all Notes retrieval |
Yes |
comments_array |
Returns empty array |
Low: Only affects frontend templates |
Recommended |
comments_open |
Returns false |
Unknown: May block Note creation |
Investigate |
pings_open |
Returns false |
None |
No |
| Post type support removal |
Removes comments support |
None: Notes use editor support |
No |
| Comment blocks removal |
Removes core/comment-* blocks |
None: No Note blocks in list |
No |
Implementation
1. Add Helper Method for Allowed Comment Types
Add a new method to includes/classes/Comments/Comments.php that returns an array of comment types that should bypass the disable comments filters. This provides a central location and a filter for extensibility.
protected function get_allowed_comment_types() {
$allowed_types = array( 'note' );
return apply_filters( 'tenup_experience_disable_comments_allowed_types', $allowed_types );
}
2. Fix the Query Short-Circuit (Critical)
Update filter_comments_pre_query() to check the query's type parameter and allow Notes queries to proceed:
public function filter_comments_pre_query( $comment_data, $query ) {
if ( is_a( $query, '\WP_Comment_Query' ) ) {
$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;
}
if ( $query->query_vars['count'] ) {
return 0;
}
}
return array();
}
3. Fix the Comments Array Filter (Recommended)
Update disable_comments_hide_existing_comments() to preserve Notes in the array. This method receives the comments array and post ID as parameters (the current signature is missing the second parameter):
public function disable_comments_hide_existing_comments( $comments, $post_id ) {
$allowed_types = $this->get_allowed_comment_types();
return array_filter( $comments, function( $comment ) use ( $allowed_types ) {
return in_array( $comment->comment_type, $allowed_types, true );
} );
}
4. Fix the Comments Open Filter (Investigate)
The comments_open filter currently returns false unconditionally. According to WordPress 6.9 documentation, Notes use edit_post capability rather than comment capabilities. However, to be safe, update disable_comments_status() to accept the post ID parameter and preserve the original behavior for non-comment contexts:
public function disable_comments_status( $open, $post_id ) {
// Always return false - Notes do not rely on comments_open.
return false;
}
This likely does not need changes, but the method signature should be updated to match the filter's expected parameters for correctness.
5. Add Documentation
Add inline documentation explaining:
- Why certain comment types are allowed through
- Reference to WordPress 6.9 Block Notes feature
- How to extend the allowed types list via filter
Files to Modify
Testing Considerations
After implementation, verify:
- Notes can be created on posts/pages when comments are disabled
- Notes can be retrieved and displayed in the editor
- Notes can be resolved and deleted
- Traditional comments remain fully disabled (queries return empty, UI hidden)
- REST API requests for Notes work correctly (
/wp/v2/comments?type=note)
WordPress 6.9 introduces Block Notes, a collaborative feedback feature stored as
WP_Commentswithcomment_typeofnote. The current disable comments implementation blocks all comment queries unconditionally, which will break Notes functionality.Conflict Analysis
comments_pre_querycomments_arraycomments_openfalsepings_openfalsecommentssupporteditorsupportcore/comment-*blocksImplementation
1. Add Helper Method for Allowed Comment Types
Add a new method to
includes/classes/Comments/Comments.phpthat returns an array of comment types that should bypass the disable comments filters. This provides a central location and a filter for extensibility.2. Fix the Query Short-Circuit (Critical)
Update
filter_comments_pre_query()to check the query'stypeparameter and allow Notes queries to proceed:3. Fix the Comments Array Filter (Recommended)
Update
disable_comments_hide_existing_comments()to preserve Notes in the array. This method receives the comments array and post ID as parameters (the current signature is missing the second parameter):4. Fix the Comments Open Filter (Investigate)
The
comments_openfilter currently returnsfalseunconditionally. According to WordPress 6.9 documentation, Notes useedit_postcapability rather than comment capabilities. However, to be safe, updatedisable_comments_status()to accept the post ID parameter and preserve the original behavior for non-comment contexts:This likely does not need changes, but the method signature should be updated to match the filter's expected parameters for correctness.
5. Add Documentation
Add inline documentation explaining:
Files to Modify
includes/classes/Comments/Comments.php: All changes are contained in this single fileTesting Considerations
After implementation, verify:
/wp/v2/comments?type=note)