Add Tag transformer for WP_Term objects#2552
Merged
Conversation
Introduces the Tag transformer class to handle WP_Term objects in the Factory. The Factory now returns a Tag instance for 'WP_Term' type, enabling transformation of terms to ActivityPub objects.
There was a problem hiding this comment.
Pull request overview
This pull request adds support for transforming WordPress WP_Term objects into ActivityPub OrderedCollection objects. The implementation introduces a new Tag transformer class that handles taxonomy terms (tags, categories, and custom taxonomies) and integrates it into the existing transformer factory pattern.
Key Changes
- New
Tagtransformer class that convertsWP_Termobjects to ActivityPubOrderedCollectiontype - Factory pattern integration to automatically route
WP_Termobjects to the Tag transformer - Comprehensive test coverage for the new transformer and factory integration
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
includes/transformer/class-tag.php |
New transformer class that converts WP_Term objects to OrderedCollection ActivityPub objects with term link as ID |
includes/transformer/class-factory.php |
Added WP_Term case to factory switch statement to instantiate Tag transformer |
tests/phpunit/tests/includes/transformer/class-test-tag.php |
New test file with comprehensive coverage for Tag transformer functionality across different taxonomies |
tests/phpunit/tests/includes/transformer/class-test-factory.php |
Added test case and setup for WP_Term factory integration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
obenland
reviewed
Dec 1, 2025
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Refactored the Tag transformer class to Term, updating all references and related test files. This change improves clarity by aligning the transformer name with the WP_Term object it handles.
obenland
approved these changes
Dec 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes:
Adds a new Tag transformer class to handle WP_Term objects, converting them to ActivityPub OrderedCollection objects. This enables support for turning tags, categories, and custom taxonomies into federated collections in the Reader view.
Tagclass inincludes/transformer/class-tag.phpFactory::get_transformer()Other information:
Testing instructions:
Factory::get_transformer( $term )to_object()and verify it returns an OrderedCollectionnpm run env-test -- --filter=Test_TagChangelog entry
Changelog Entry Details
Significance
Type
Message
Adds support for turning tags, categories, and custom taxonomies into federated collections in the Reader view so you can browse and follow topics more seamlessly.