Skip to content

Fixes fetching terms on XML-RPC disabled sites#25767

Open
crazytonyli wants to merge 6 commits into
trunkfrom
bugfix/selfhosted-taxonomy-rest
Open

Fixes fetching terms on XML-RPC disabled sites#25767
crazytonyli wants to merge 6 commits into
trunkfrom
bugfix/selfhosted-taxonomy-rest

Conversation

@crazytonyli

@crazytonyli crazytonyli commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Note

I recommend reviewing this PR commit by commit: the first commit is the fix, the second is a TagsViewModel construction cleanup.

Description

Fixes #25758 / CMM-2143

I thought the tags (and custom terms) selection screen uses core REST API when available. But that is not the case. My misunderstanding probably comes from the TagsViewModel initialisers being a bit messy. The tags selection type names need a bit more cleanup, due to how it's expanded from tags-only to all terms.

The second commit cleans up the area a little bit. But there are more can be done.

Testing instructions

Disable XML-RPC on a self-hosted site, open a new post's Post Settings and confirm Categories and Tags load, can be selected, and new ones can be created.

Self-hosted taxonomy went through XML-RPC term methods, which some hosts block at the WAF, breaking tags and categories on new posts (#25758). Prefer the core REST API (wp/v2) whenever the site has application-password access, keeping XML-RPC only as a fallback for legacy sites without it.
The two convenience initializers were ambiguous about when to use each. Introduce tags(for:) and taxonomy(_:client:) so call sites read by intent, and drop the unused blog parameter that was threaded through the custom taxonomy path.
@crazytonyli crazytonyli added this to the 27.1 milestone Jul 9, 2026
@crazytonyli crazytonyli requested a review from jkmassel July 9, 2026 07:37
@dangermattic

Copy link
Copy Markdown
Collaborator
1 Warning
⚠️ View files have been modified, but no screenshot or video is included in the pull request. Consider adding some for clarity.

Generated by 🚫 Danger

@wpmobilebot

wpmobilebot commented Jul 9, 2026

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 Number33133
VersionPR #25767
Bundle IDorg.wordpress.alpha
Commitf3b73d0
Installation URL47bfgk0u4mc9g
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

wpmobilebot commented Jul 9, 2026

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 Number33133
VersionPR #25767
Bundle IDcom.jetpack.alpha
Commitf3b73d0
Installation URL1udvncing5m88
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

TaxonomyServiceRemoteCoreREST *coreREST = [[TaxonomyServiceRemoteCoreREST alloc] initWithBlog:blog];
if (coreREST) {
return coreREST;
}

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.

Just a reminder to myself: we need to make sure categories can be fully fetched, especially on atomic sites(I think?).

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 have verified that all categories can be fetched.

@jkmassel jkmassel left a comment

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.

I think this PR will break tags/categories for non-admin users as written. A better fix would probably be to route tag and category lookup through context=view for non-editing cases? So unless someone is actively editing a term, we should use context=view, and only use context=edit for admins?

WDYT?

@crazytonyli

Copy link
Copy Markdown
Contributor Author

@jkmassel Good catch! The viewing tags and categories list issue should be addressed in ee54ceb

@crazytonyli crazytonyli requested a review from jkmassel July 14, 2026 01:13
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.

Categories and Tags not working for new posts on self-hosted sites (iOS app)

4 participants