Repository navigation
Description
From Claude:
These are the non-blocking findings from reviewing #26356 at ad746cb8fa. That PR makes new self-hosted posts keep the site's discussion defaults when they're created over XML-RPC. It works as described and was approved. The items below are gaps it leaves, not regressions that block it.
-
When the site's discussion defaults aren't known yet, new posts created over XML-RPC still get comments closed.
What happens:
wp.newPostcloses comments whencomment_statusis left out, even on a site that defaults to open. Preserve discussion settings when creating posts over XML-RPC #26356 fixes this by sending the saved site default. When the app hasn't saved the defaults yet, the status is unknown, the field is left out, and the server closes comments.When it happens:
- The settings fetch hasn't finished yet, for example the first post right after adding a site.
- The settings fetch failed.
- A local draft was saved before upgrading to the version with Preserve discussion settings when creating posts over XML-RPC #26356.
What the user sees: a new post published with comments closed, although the site allows comments.
Suggested fix: don't wait for the background settings sync. It only runs on a cold launch, pull to refresh or a site switch, it may already have failed, and it fetches every setting. Instead, in
PostRepository._create, when creating apostover XML-RPC with the comment status still unknown, make one targeted call first:wp.getOptions(blogID, user, pass, ["default_comment_status", "default_ping_status"])- Fill in the unknown statuses from the response before
wp.newPost. - Save them to
blog.settingsso the next post doesn't need the call. - If the call fails, keep the current behaviour (leave the fields out) and log it.
- This costs one extra request, only while the defaults are unknown.
- Check first whether
wp.getOptionsworks for authors and editors./wp/v2/settingsneedsmanage_options;wp.getOptionsis believed not to, but that hasn't been tested.
How this was checked: on a local WordPress 7.1.4 site,
wp.newPostwithcomment_statusleft out saved the post with comments closed and pings open while the site default was open/open. The unknown-defaults case itself was confirmed by reading the code, not reproduced in the app. -
If the site's default changes while the app is open, new posts keep using the old default until the app refreshes its settings.
What happens:
Blog.createPost()copies the saved site default onto every new post, and Preserve discussion settings when creating posts over XML-RPC #26356 now sends that value explicitly over XML-RPC. If an admin changes the default in wp-admin, new posts from the app follow the old value until a cold launch or a pull to refresh on My Site. Going back to the Posts screen doesn't refresh it.Who is affected: self-hosted sites saving posts over XML-RPC. On sites using Core REST (XML-RPC off), the app already sent the saved defaults explicitly before Preserve discussion settings when creating posts over XML-RPC #26356, so this is pre-existing there.
How this was checked: in the app on a simulator, with the saved defaults at open/open, the site default was changed to closed/closed over XML-RPC and a new draft was saved without relaunching. The server saved it with comments open and pings open. After a cold launch, the saved defaults updated to closed/closed and the next draft was saved closed/closed.
Suggested fix: by save time the app can't tell a value the user chose from one copied from the site default, so it can't know which ones to refresh. Fixing it means tracking whether the user changed the setting. That is the
RemotePostDiscussionSettingsrefactor described in the TODO inRemotePostParameters.swift. Low impact; fine to fold into that refactor. -
Cleanup.
- The doc comment on
combinedSettingsinBlogService+Settings.swiftstill says the XML-RPC fallback only supplies name, tagline and privacy. Since Preserve discussion settings when creating posts over XML-RPC #26356 its settings also carry the discussion defaults (they're used when the Core REST fetch fails, for example for non-admin users). - Preserve discussion settings when creating posts over XML-RPC #26356 reformatted one unrelated
#expectline inRemotePostCreateParametersTests.swift.
- The doc comment on
Activity
dangermattic commentedon Nov 9, 2026
Thanks for reporting! 👍