Merged
Conversation
Adds a community snippet that sets a post's ActivityPub language based on post tags matching language codes. Useful for multilingual blogs that tag posts with language identifiers like 'en', 'fr', 'de'.
Guards against WP_Error, which is a possible return type. Matches defensive patterns used elsewhere in the codebase.
There was a problem hiding this comment.
Pull request overview
This PR adds a new community snippet that automatically sets a post's ActivityPub language based on tags matching language codes (e.g., en, fr, de), enabling proper language metadata for multilingual WordPress sites in the Fediverse.
Changes:
- New
locale-from-tagssnippet with filter hook to detect language code tags and override the default locale - Documentation explaining installation, configuration, and usage
- Entry in the main snippets README listing the new snippet
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| snippets/locale-from-tags/locale-from-tags.php | Core snippet implementation with set_locale_from_tags() function and filter hook |
| snippets/locale-from-tags/README.md | Documentation covering installation, requirements, configuration, and origin |
| snippets/README.md | Added entry for the new snippet in the snippets directory table |
| .github/changelog/2923-from-description | Changelog entry for this patch addition |
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:
en,fr,de).Other information:
This is a community snippet (a standalone micro-plugin in
snippets/), not a change to the core plugin. No new tests are needed.Testing instructions:
snippets/locale-from-tags/folder intowp-content/plugins/and activate it.en,fr,de).?activitypubor check the outbox) — thecontentMapkey should reflect the tag's language code instead of the site's default locale.functions.php:Changelog entry
Changelog Entry Details
Significance
Type
Message
Add Locale from Tags community snippet.