Opened 6 weeks ago
Closed 13 days ago
#65613 closed defect (bug) (fixed)
Notes should not appear in comments feed
| Reported by: | odkdn1 | Owned by: | adamsilverstein |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.0.3 |
| Component: | Comments | Version: | 7.0.1 |
| Severity: | normal | Keywords: | commit fixed-major dev-reviewed |
| Cc: | Focuses: | privacy |
Description
Related to https://core.trac.wordpress.org/ticket/64145 the RSS feeds at <site-url>/comments/feed and <site-url>/comments/feed/atom still show internal notes to the public.
Quote from the referenced issue:
Notes should never appear in the context of regular (front end) comments. Although they share the same comments table, notes use a specific "note" comment type. Notes of this type need to be consistently excluded wherever comments or comment counts are shown.
Change History (15)
@adamsilverstein commented on PR #12486:
5 weeks ago
#3
ps. I've started working on https://core.trac.wordpress.org/ticket/35214
@westonruter commented on PR #12486:
5 weeks ago
#5
I confirmed that the three new tests all fail when running against trunk as expected:
There were 3 failures: 1) Tests_Query_CommentFeed::test_main_comment_feed_should_exclude_notes Comments feed should not include notes. Failed asserting that an array does not contain 17. /var/www/tests/phpunit/tests/query/commentFeed.php:113 2) Tests_Query_CommentFeed::test_archive_comment_feed_should_exclude_notes Archive comments feed should not include notes. Failed asserting that an array does not contain 18. /var/www/tests/phpunit/tests/query/commentFeed.php:142 3) Tests_Query_CommentFeed::test_single_comment_feed_should_exclude_notes Singular comments feed should not include notes. Failed asserting that an array does not contain 19. /var/www/tests/phpunit/tests/query/commentFeed.php:175
#6
@
5 weeks ago
@odkdn1 can you give https://github.com/WordPress/wordpress-develop/pull/12486 a test to verify it fixes the issue you reported?
gubser commented on PR #12486:
5 weeks ago
#7
I tested it and it works, thank you :+1:
Steps
- Created dev environment from trunk.
- Added note, set to resolved.
- Note appears in http://localhost:8889/comments/feed and http://localhost:8889/comments/feed/atom
- Switched to [adamsilverstein:fix/65613-notes-comment-feed your branch]
- Rebuild
- Note does not appear anymore in http://localhost:8889/comments/feed and http://localhost:8889/comments/feed/atom
#8
@
5 weeks ago
Patch testing report
Patch / PR tested
- https://github.com/WordPress/wordpress-develop/pull/12486
- trunk @ 1c57961f42 with PR branch
fix/65613-notes-comment-feed
Environment
WordPress: 7.1-alpha-62161-src
PHP: 8.2.18 (Docker)
MySQL: 8.0.36
OS: macOS 26.5.2
Verified at the query layer via PHPUnit (Tests_Query_CommentFeed), all three raw feed paths
Local wordpress-develop @ http://localhost:8889
Steps
- Checked out PR branch
fix/65613-notes-comment-feed, rannpm run build:dev. - Ran the three new tests (
test_main/archive/single_comment_feed_should_exclude_notes). - Reverted ONLY
src/wp-includes/class-wp-query.phpback to trunk (keeping the new tests), rebuilt, and re-ran the three tests to reproduce the bug. - Restored the fix, rebuilt, and re-ran the three tests plus the full
commentFeed.phpclass and thefeed/feedsgroups.
Results
- Before state (fix reverted): fail as expected — the
notecomment leaks into all three feeds (main #17, archive #18, singular #19), reproducing the ticket. - Main/front-page comment feed: pass — note excluded, all 15 regular comments retained.
- Archive/search comment feed: pass — note excluded, count correct (15).
- Singular post comment feed: pass — note excluded, count correct (5).
- Regression: pass — full
commentFeed.php(6 tests),feedgroup (44 tests, 318 assertions),feedsgroup all green.
Conclusion
PR #12486 adds comment_type != 'note' to the three raw comment-feed WHERE clauses in WP_Query, closing the gap left by [61105] / #64145, which only guarded WP_Comment_Query. The change is minimal (3 production lines), idiomatic, and matches the raw-SQL exclusion already used by wp_count_comments(). It is NULL-safe (comment_type is NOT NULL DEFAULT '', so regular/pingback/trackback comments are retained) and column-qualified so it is unambiguous under the posts JOIN. No backward-compatibility concern: the singular exclusion sits inside the default value passed to the comment_feed_where filter, so plugins can still adjust it. The only extra-scope items are test-only cosmetics (typed static properties, : void return types). Recommend commit.
#11
@
3 weeks ago
Hi @odkdn1
Is there a preferred way you would like to be credited in an upcoming WP release post? So far we have 'odkdn1' linking to your WordPress.org profile.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
See also https://github.com/WordPress/gutenberg/issues/72607#issuecomment-4944348243