Skip to content

Post Settings: Support custom taxonomies - #24964

Merged
crazytonyli merged 3 commits into
trunkfrom
taxonomies/add-custom-terms-post-settings
Nov 4, 2025
Merged

crazytonyli merged 3 commits into
trunkfrom
taxonomies/add-custom-terms-post-settings

Conversation

@crazytonyli

Copy link
Copy Markdown
Contributor

Description

This PR allows updating the terms of custom taxonomies in posts. The feature requires application passwords and works on all sites where custom taxonomies are available.

Testing instructions

Verify all terms (including tags and categories) can be updated.

@crazytonyli crazytonyli added this to the 26.5 milestone Oct 30, 2025
@crazytonyli
crazytonyli requested a review from kean October 30, 2025 22:43
@dangermattic

Copy link
Copy Markdown
Collaborator
2 Warnings
⚠️ View files have been modified, but no screenshot or video is included in the pull request. Consider adding some for clarity.
⚠️ This PR is larger than 500 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.

Generated by 🚫 Danger

public var format: String?
public var isSticky = false
public var tags: [String] = []
public var otherTerms: [String: [String]] = [:]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kean I need to add similar code, like updating the new otherTerms variable, assigning its value to another instance, etc. I don't think I missed any places. But can you pay extra attention to reviewing this part? Thanks!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) it looks good, but it might be worth adding a convenience terms property/method that would combine tags and other terms to remove some duplication and also simplify encoding.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The duplication is across two types: RemotePostUpdateParameters and RemotePostCreateParameters, and different encoders (and keys) for XMLRPC and REST API. I'll leave the code as it is for now, for simplicity.

@wpmobilebot

wpmobilebot commented Oct 30, 2025 •

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress
ConfigurationRelease-Alpha
Build Number29646
VersionPR #24964
Bundle IDorg.wordpress.alpha
Commita90d52e
Installation URL3hv4vieoaevf8
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

wpmobilebot commented Oct 30, 2025 •

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack
ConfigurationRelease-Alpha
Build Number29646
VersionPR #24964
Bundle IDcom.jetpack.alpha
Commita90d52e
Installation URL6hvnhsepqhrt8
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@crazytonyli
crazytonyli force-pushed the taxonomies/add-custom-terms-post-settings branch 2 times, most recently from bb51980 to ad86748 Compare November 3, 2025 01:41
public var format: String?
public var isSticky = false
public var tags: [String] = []
public var otherTerms: [String: [String]] = [:]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) it looks good, but it might be worth adding a convenience terms property/method that would combine tags and other terms to remove some duplication and also simplify encoding.

return self;
}

+ (BOOL)compareOtherTerms:(NSDictionary<NSString *, NSArray<NSString *> *> *)lhs withAnother:(NSDictionary<NSString *, NSArray<NSString *> *> *)rhs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) It looks like it's only used from Swift. It would be great to implement it in Swift as well if possible.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in a71460b.

@property (nonatomic, strong) NSArray *categories;
@property (nonatomic, strong) NSArray *revisions;
@property (nonatomic, strong) NSArray *tags;
//@property (nonatomic, strong) NSArray<RemotePostTerm *> *otherTerms;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented out code.


private enum Strings {
static let tags = NSLocalizedString(
"Tags",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit ) should use namespacig

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reused the existing translation for "Tags", considering it's a pretty common term.

@crazytonyli
crazytonyli force-pushed the taxonomies/add-custom-terms-post-settings branch from ad86748 to a71460b Compare November 4, 2025 02:21
@crazytonyli
crazytonyli enabled auto-merge November 4, 2025 02:24
@sonarqubecloud

sonarqubecloud Bot commented Nov 4, 2025

Copy link
Copy Markdown

@crazytonyli
crazytonyli added this pull request to the merge queue Nov 4, 2025
Merged via the queue into trunk with commit a252e96 Nov 4, 2025
@crazytonyli
crazytonyli deleted the taxonomies/add-custom-terms-post-settings branch November 4, 2025 02:53
crazytonyli added a commit that referenced this pull request Dec 17, 2025
This is a regression introduced in #24964. We should not check if values
are an empty list in the "update" parameter types.
crazytonyli added a commit that referenced this pull request Dec 17, 2025
This is a regression introduced in #24964. We should not check if values
are an empty list in the "update" parameter types.
crazytonyli added a commit that referenced this pull request Dec 17, 2025
This is a regression introduced in #24964. We should not check if values
are an empty list in the "update" parameter types.
github-merge-queue Bot pushed a commit that referenced this pull request Dec 17, 2025
* Bump version number

* Fix CMM-1065: Find existing tag before creating a new one (#25061)

* Fix CMM-1065: Find existing tag before creating a new one

The issue was introduced in
#24955.

* Replace original input with the actual tag

* Invert a boolean check of most recently used tags first (#25065)

The issue was introduced in #24955. I missed a `!` in the refactor.

* Fix an issue where the app fails to remove tags from posts (#25067)

This is a regression introduced in #24964. We should not check if values
are an empty list in the "update" parameter types.

* Move finding existing tag code (#25068)

Moving the code to the view model, so that it can cover tags and custom
taxonomy terms, which are two seperate `TagsServiceProtocol`
implementations.

* Clear the tag input field after tapping the Enter key (#25069)

We already have code that clears the text field in the `addTag`
function. However, during testing, I noticed it does not always work.
The new change here makes sure the `UITextField` is cleared, because we
are calling the UIKit directly, instead of relying on SwiftUI to pass
the `text` changes to UIKit.

* Manually bump version number

---------

Co-authored-by: Tony Li <tony.li@automattic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants