Skip to content

Posts: follow-ups from self-hosted discussion defaults (#26356) #26370

Open

Description

@jkmassel

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.newPost closes comments when comment_status is 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:

    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 a post over 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.settings so 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.getOptions works for authors and editors. /wp/v2/settings needs manage_options; wp.getOptions is believed not to, but that hasn't been tested.

    How this was checked: on a local WordPress 7.1.4 site, wp.newPost with comment_status left 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 RemotePostDiscussionSettings refactor described in the TODO in RemotePostParameters.swift. Low impact; fine to fold into that refactor.

  • Cleanup.

Activity

  1. dangermattic commented on Nov 9, 2026

    @dangermattic
    Collaborator

    Thanks for reporting! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions