I was wondering how does external app works for wordpress.com or wordpress.org.

Directly connecting to the wordpress database seems a bad idea to me.


  • How can I create an app or get / post data from the wordpress database?
  • Is there a JSON API or XML API format so that I can easily exchange data between the two?

WordPress features a very rich XML-RPC interface that you can work with from external applications. It provides you access to most of the functionality you'd have directly in the admin - write posts, edit posts, edit comments, create/edit categories, manage site options, upload files, etc.

As a matter of fact, certain third-party applications are already using this functionality to allow you to manage WordPress remotely - a good example is Windows Live Writer. It works for both self-hosted (.org) sites and sites hosted on WordPress.com.

So if you need to get posts from WordPress, I'd recommend following API calls:

  • metaWeblog.getPost - for retrieving a single post based on its ID.
  • metaWeblog.getRecentPosts - for retrieving a list of recently published posts

You can also create/edit posts with these API calls:

  • metaWeblog.newPost - create a new post
  • metaWeblog.editPost - edit an existing post

There's more information about creating your own application (and an explanation as to why WordPress supports third-party APIs like metaWeblog) in the Codex.

I've also written tutorials on how to use the API and documentation specific to making/parsing metaWeblog API requests.

| improve this answer | |

For self-hosted WordPress blogs, you can use the JSON API plugin. I'm working with it on a project right now... it's fairly full-featured OOB, and it's extensible. Documentation is here.

Not sure about wordpress.com blogs.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.