feat(block-theme): move co-authors RSS feed code to the Newspack Plugin#4629
feat(block-theme): move co-authors RSS feed code to the Newspack Plugin#4629laurelfulford merged 6 commits intotrunkfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a Newspack-side integration for the Co-Authors Plus plugin so RSS/feed author output can include all co-authors, and wires that integration into the main plugin include list.
Changes:
- Added a
Newspack\RSS_Feedintegration that filtersthe_authorin feed contexts to output co-authors. - Included the new integration file in
Newspack::includes()so it loads with other Co-Authors Plus integrations.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
includes/plugins/co-authors-plus/class-rss-feed.php |
Introduces a feed-specific the_author filter to return co-author output in feeds. |
includes/class-newspack.php |
Loads the new Co-Authors Plus RSS integration during plugin includes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
adekbadek
left a comment
There was a problem hiding this comment.
Tested with Co-Authors Plus active, posts with single, two, and three co-authors. RSS feed correctly shows all co-authors in <dc:creator>. Frontend author display is unaffected.
The migration is well done – proper namespacing, sanitization (wp_strip_all_tags + html_entity_decode), and solid tests. See inline comments for a minor note on separator behavior.
| } | ||
| return implode( ', ', array_map( fn( $author ) => wp_strip_all_tags( html_entity_decode( $author->display_name ) ), $coauthors ) ); | ||
| } | ||
| } |
There was a problem hiding this comment.
Nit (non-blocking): the old coauthors() template tag defaults to and before the last author, so 3 co-authors produced "Alice, Bob and Carol". With implode it's now "Alice, Bob, Carol". Per A8C/WPCOM style guidance, the ideal format here would be an oxford comma: "Alice, Bob, and Carol". Not blocking on this, but worth considering – especially since this changes existing behavior for sites with 3+ co-authors on a post.
There was a problem hiding this comment.
Thanks for catching that, @adekbadek 🤦♀️ the formatting's been fixed in 2b92d2b.
| public function test_returns_combined_coauthor_names_in_feed() { | ||
| $post_id = $this->factory->post->create(); | ||
| $GLOBALS['_test_cap_coauthors'] = [ | ||
| $this->make_coauthor( 'Jane Smith' ), |
There was a problem hiding this comment.
Suggestion: consider adding a test case for 3+ co-authors. The current tests cover 0, 1, and 2 authors, but the separator behavior only diverges from the old implementation at 3+.
There was a problem hiding this comment.
Good call! Tests have been updated in 2b92d2b!
|
Thanks for the testing, @adekbadek! Nits have been fixed, mergin'! |
|
Hey @laurelfulford, good job getting this PR merged! 🎉 Now, the Please check if this PR needs to be included in the "Upcoming Changes" and "Release Notes" doc. If it doesn't, simply remove the label. If it does, please add an entry to our shared document, with screenshots and testing instructions if applicable, then remove the label. Thank you! ❤️ |
All Submissions:
Changes proposed in this Pull Request:
This PR and Automattic/newspack-theme#2671 remove functionality that adds Co-Authors to the RSS feed from the classic theme, and adds it to the Newspack Plugin. This makes it available regardless of theme used.
Closes NPPD-1345
How to test the changes in this Pull Request:
<dc:creator>in the posts you created.Other information: