Posting to WordPress using the WordPress for Android App

wordpress logoI remember using the official WordPress app for Android a few years back and it was pretty good, and then it wasn’t for some reason that I can’t remember, and then it was good again. This is the nature of software and updates: even the smallest code change can cause a new bug, or worse, a regression of some kind. Anyhow, since starting up a couple of new blogs recently, I wanted to revisit that mobile functionality and be able to write and upload posts when I’m on the run, because it’s 2015, right?

Anyway, I started noticing that I was able to upload posts from one of my blogs using WordPress for Android without a problem. But for this blog (yes, the one you’re reading), I would get the following error in my notification bar (denoted with the exclamation in the triangle):

Post Upload Failed: Sorry, an error occurred while uploading the Post.

I tried everything to get my post to upload and I finally did get it to work but not before taking a lot of different troubleshooting steps to narrow down the issue.

When you get errors like this, it’s often worth checking the logs, although there was absolutely nothing in the logs via cpanel. I could see the POST directives int he logs but no errors to report. I was starting to think that it was a permissions issue but comparing the perms on the folders in /public_htmtl/ everything looked fine.
I also made sure that the XML-RPC server was running and that xmlrpc.php was  working properly. You can try this yourself by doing the following:
http://yourWordpressSite/xmlrpc.php

It should return this message if all is good, which mine did:
XML-RPC server accepts POST requests only.

Then I typed the following and made sure that it the xml was correctly returned :
http://yourWordpressSite/xmlrpc.php?rsd

Know your HTTP error codes

Looking closer at the notification on my phone, the entire error was actually:
Post Upload Failed: An error occurred while uploading the Post HTTP status code: 404 was returned. Not Found - exception: HTTP status code: 404 was returned. Not Found

This means it is not a permissions issue but that the POST isn’t even making it to wp-content. The website was clearly up and running as well.

Finally, I tried creating a new post via WordPress for Android and uploaded it. Success! So something was up with the post that I was trying to upload. After a bit more searching around, the issue seems to have to do with the actual size of the post. I tried creating a few more new posts and did not have an issue.

A bit more research turned up a this post on the Android for WordPress forums describing the same issue. The Admin suggests a “phone reboot / try a different wifi network” solution, but I can assure you that this didn’t work for me. It’s also suggested to try a smaller default image width (under WP android settings) but this didn’t work for me either.

So what worked for me: Write smaller posts? I guess? I ended having to copy my brilliant post from my phone when I was back at my workstation. More testing to come.

Developer: Automattic, Inc
Download it from the Play Store

The clue was in the notification

Uploading posts with the WordPress for Android app started acting up again to the point where I could not upload or update any post. It essentially could no longer sync with WordPress. I was receiving the same notification as above:

"Post Upload Failed: An error occurred while uploading the Post HTTP status code: 404 was returned. Not Found - exception: HTTP status code: 404 was returned. Not Found

A 404 error suggests that the website is not available. Yet, I could access it from my desktop and my phone. Or could I? I tried to hit my site from my phone and suddenly I could not, even though the site was up. So I did the following:

  1. Disabled W3 Cache plugin – This had no effect
  2. Cleared the browser cache and history on the phone – that worked in terms of being able to hit my site from my phone. I could still not hit it from the WordPress app.
  3. Removed my site from the WordPress app – After removing it, I could no longer re-add it and got the error: “Couldn’t connect to the WordPress site”. This suggests an access issue.
  4. Tested xmlrpc access with http://xmlrpc.eritreo.it/ and it fails. My other site works, so this looks like something changed since the XML-RPC server is suddenly not accepting POST requests

Finally, after contacting my web host, they confirmed that xml-rpc was recently disabled on the shared host due to a recent DDoS attack! All they needed to do was whitelist my domain and uploading posts with the WordPress app once again works as expected.

Was any of this helpful? Let us know!

Leave a Reply

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