@Smokey rightly pointed out that my "solution" to force enable comments on posts made via XML_RPC from the micro.blog apps was too draconian. Essentially it enabled comments on anything, regardless of how it was posted or updated, and was a quick and dirty workaround.

It "worked" but not in the way it should.

I, therefore, wanted to find a way to only force enable comments on new posts made specifically by this method and not post updates. I think the following code works:

add_action ('xmlrpc_call', 'check_new_post' );

function check_new_post( $method ) {
    if( 'wp.newPost' === $method ) {
        add_filter( 'wp_insert_post_data', 'open_comments', 100, 1 );
    }
}

function open_comments ($postarr) {
    $postarr[comment_status] = 'open';
    return $postarr;
}

This checks if the wp.newPost method is called when an xml_rpc call is made - if so it adds the filter to open the comments.

I've updated the plugin here if you want to try it and would appreciate any feedback. It's still experimental but seems to work for me.

  1. JohnPhilpin says: #
    @colinwalker favorited and will come back later to install and have a prod … does this need other web mention plugins – or can this replace what I have?
  2. colinwalker says: #
    @JohnPhilpin This relates to native comments, not webmentions. For some reason posts made via the m.b apps do not have comments enabled if that is the default setting on WordPress.
  3. devilgate says: #
    @colinwalker I checked my own setup, and it’s the same. I may add your plugin. Though most of the comments I get come from Micro.blog.
  4. simonwoods says: #
    @colinwalker Is this needed if people are replying on MB to an MB post that comes from a RSS feed?

    So: post on WP -> goes to MB via RSS feed -> person replies on MB -> reply appears on WP site

  5. colinwalker says: #
    @simonwoods Replies on MB shouldn’t be affected as they are sent via webmention and, in my experience, webmentions go through okay even if comments are closed.
  6. simonwoods says: #
    @colinwalker OK sounds good, thanks. 👍 I’ll wait to see if everything is working as and when I get replies since that seems to be the easiest way to identify problems.