Jump to content
Sign in to follow this  

Live Writer XMLRPC issue *SOLVED!!!* (I think)

Recommended Posts


I have been battling with Windows Live Writer for weeks, trying to get it to connect to my blog. Others have been struggling with the same issue and as near as I can tell nobody has found a solution, as you can see from this thread http://www.pagelines.com/forum/discussion/comment/69584#Comment_69584. But I think I fixed it. I'll post my answer there too, but I get the impression that nobody's watching that thread anymore, so I thought I'd post my solution in a new discussion. In short, I was seeing two distinct, but related problem. First, when trying to download my blog's theme to Windows Live Writer, it would fail. Second (this second problem was actually the cause of the first), when I tried to publish a post to the blog Live Writer would return an error message saying that it failed (even though the post WAS actually published). The error was: ************************************************************* "The response to the metaWeblog.newPost method received from the blog server was invalid: Invalid response document returned from XmlRpc server" ************************************************************* I tracked down the Live Writer Log and deleted it, and then immediately tried to publish a post, producing the error message that so many people are getting. This created a new, relatively small log file that helped me locate the cause of the error message. One line in the log appeared to be the problem. It was repeated approx. 30 times: ************************************************************* Warning: strpos() [function.strpos]: Empty delimiter in /homepages/22/d334612527/htdocs/Sites/BestKidIpadApps/wp-includes/class-wp-xmlrpc-server.php on line 2469

************************************************************* After that line I see four more warnings, but I think they are related to the line above because they reference line 2469 of that same PHP file in them: ************************************************************* Warning: Cannot modify header information - headers already sent by (output started at /homepages/22/d334612527/htdocs/Sites/BestKidIpadApps/wp-includes/class-wp-xmlrpc-server.php:2469) in /homepages/22/d334612527/htdocs/Sites/BestKidIpadApps/wp-includes/class-IXR.php on line 471

************************************************************* So I found class-wp-xmlrpc-server.php and scrolled down to Line 2469, which reads: ************************************************************* if ( strpos( $post_content, $file->guid ) !== false ) ************************************************************* So, I added the following line directly above that one and it seems to have solved my problem entirely, but I hope if I've done something dangerous one of you PHP gurus will let me know. I have practically no idea what I'm doing. ************************************************************* if($file->guid && !($file->guid == NULL)) ************************************************************* I hope this helps others. I have the impression that a lot of people have struggled with this and, very likely, the solution was to just not use Windows Live Writer, which is a shame because it's so much more capable a program than any other offline blog editor. For reference, here's a larger snippet of my final code: ************************************************************* // find any unattached files $attachments = $wpdb->get_results( "SELECT ID, guid FROM {$wpdb->posts} WHERE post_parent = '0' AND post_type = 'attachment'" ); if ( is_array( $attachments ) ) { foreach ( $attachments as $file ) { if($file->guid && !($file->guid == NULL)) if ( strpos( $post_content, $file->guid ) !== false ) $wpdb->update($wpdb->posts, array('post_parent' => $post_ID), array('ID' => $file->ID) ); } *************************************************************

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this