Merged
Conversation
Contributor
Test this PR in WordPress PlaygroundYou can test this pull request directly in WordPress Playground: This will install and activate the plugin with the changes from this PR. |
64cbc44 to
40d42b4
Compare
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.
Summary
Extracts the
friend_tagtaxonomy logic into a dedicatedFriend_Tagclass (includes/class-friend-tag.php), replacing scattered inline usage of the taxonomy throughout the codebase.Changes
Friend_Tagclass with static methods for all tag operations:register(),has_tag(),has_mention(),add_tag(),add_tags(),mention_tag(),remove_tag(),cleanup_orphaned(), etc.Friendsclass now delegates toFriend_Tag::register()andFriend_Tag::cleanup_orphaned()instead of inlining the taxonomy registration and cleanup logic.Friends::TAG_TAXONOMYreferencesFriend_Tag::TAXONOMY.Feedclass usesFriend_Tag::add_tags()instead of callingwp_set_post_terms()directly for bothfriend_tagsandfriend_mention_tags.Friend_Tag::mention_tag()to build mention slugs andFriend_Tag::has_mention()to check for mentions before queuing reply-to-comment conversion.wp_get_post_terms()+ prefix-matching loops withFriend_Tag::has_mention()and usesFriend_Tag::mention_tag()for building mention slugs.Friend_Tag::mention_tag()instead of hardcoding themention-prefix.Motivation
The
mention-prefix andfriend_tagtaxonomy name were hardcoded in many places. This consolidates them behind constants (Friend_Tag::TAXONOMY,Friend_Tag::MENTION_PREFIX) and a single class, making the tag system easier to maintain and less error-prone.