Getting WordPress multisite work with Windows Live Writer

Windows Live Writer is configured for working with WordPress multi-site the same way as with normal single-site WordPress installation, but WordPress works a bit differently in multi-site and single-site configurations. The difference consists in a few lines of code in wp-includes/class-wp-xmlrpc-server.php:

function wp_getUsersBlogs( $args ) {
    global $current_site;
    // If this isn't on WPMU then just use blogger_getUsersBlogs
    if ( !is_multisite() ) {
        array_unshift( $args, 1 );
        return $this->blogger_getUsersBlogs( $args );
    }

    //single-site verion...
}

Finally wp_getUsersBlogs (only multi-site aware function of MetaWeblog interface) in multi-site configuration passes the control to the point, where some XML-RPC call is made:

function _multisite_getUsersBlogs($args) {
    global $current_blog;
    $domain = $current_blog->domain;
    $path = $current_blog->path . 'xmlrpc.php';
    $protocol = is_ssl() ? 'https' : 'http';

    $rpc = new IXR_Client("$protocol://{$domain}{$path}");
    $rpc->query('wp.getUsersBlogs', $args[1], $args[2]);
    $blogs = $rpc->getResponse();

    if ( isset($blogs['faultCode']) )
        return new IXR_Error($blogs['faultCode'], $blogs['faultString']);

    if ( $_SERVER['HTTP_HOST'] == $domain && $_SERVER['REQUEST_URI'] == $path ) {
        return $blogs;
    } else {
        foreach ( (array) $blogs as $blog ) {
            if ( strpos($blog['url'], $_SERVER['HTTP_HOST']) )
                return array($blog);
        }
        return array();
    }
}

I do not know why XML-RPC used at this point instead of normal call, but the first thing I noticed in this code was that XML-RPC call will not work if $domain is not accessible at the server side.  So, conclusion is that WordPress multi-site requires all domains to be added to /etc/hosts, otherwise Windows Live Writer will show us the following message while trying to create new account:

You signed in successfully with a blog account, but you do not have a blog with this service provider. $#xA;Check with the blog service provider and then try again.

06/23/2013 I realized that I need to select Weblog system and enter blog entry point manually in Windows Live Writer, otherwise I got this message independently of whether I added all the domains to /etc/hosts or not (initially I need to enter something like “http://nothing” and press “Next” button). Probably something has been changed in WP 3.5.1 or prior version.

Interesting that BlogDesk behaves in the same way! It shows the following message when I press “Get Blog-ID” button:

BlogDesk was able to connect to the server but did not found any Blog-ID.

but if I enter Blog-ID manually it works fine.

Looks like both WLW and BlogDesk are unable to determine Blog-ID in this situation.

Anyway, if you read this article than my multi-site WordPress with domain mapping is working so far.

4 Responses to Getting WordPress multisite work with Windows Live Writer

  1. Stanislav says:

    For me the issue with:
    “You signed in successfully with a blog account, but you do not have a blog with this service provider. $#xA;Check with the blog service provider and then try again.”
    was the fact that I was not using local accounts but LDAP. If I setup local accounts it works.

    It is exactly as the message says, you managed to sign in, however you do not have a local account, which is probably some bug or sequrity issue.

  2. Todd Lohenry says:

    Dude! You saved my bacon. Thanks for sussing this out…

  3. Sean says:

    hey there,
    Can you please share the value you are entering into live writer to get weblog going? Presumably when you register a wordpress blog but rather are choosing the generic option and then something like /metaweblog and then the iD but could you share the secret formula/syntax?

    Thanks

  4. dmitriano says:

    Hello, Sean! With my main blog WLW works normally but with other blogs (not main) I do the following trick: initially I select URL:http://nothing and at the next screen I select WordPress 2.2+ provider and URL=http://.developernote.com/xmlrpc.php and at the final screen select my site again.

Leave a Reply

Your email address will not be published. Required fields are marked *