WordPress is a powerful platform. Although it has a rich ecosystem of themes and plugins, it is relatively easy to run into limitations of the API when building solutions on top of it.
For example, attempting to retrieve data from the WordPress API via asynchronous requests requires a bit of work. This is primarily because much of the traditional functionality within WordPress is achieved by passing key/values as arguments to one of the many functions.
I stumbled across the JSON API WordPress plugin and it seems to provide a great interface for making Ajax requests into the WordPress API.
As stated on the plugin homepage, the JSON API plugin attempts to:
- Provide a simple, consistent external interface
- Create a stable, understandable internal implementation
- Enable new types of extensions for WordPress
The plugin ships with three main features of functionality:
- Core functionality provides general methods for pulling standard data (such as posts, categories, tags, and so on).
- Respond functionality includes methods for comments and trackbacks
- Post functionality brings additional methods (such as post creation) to the framework
Once installed, you can call into one of the many functions from your application. All response data is provided in the form of JSON so it’s lightweight, fast, and easy to parse.
Because of the nature of asynchronous requests, curious visitors could easily inspect a significant amount of data – such as your post content – using something such as JSONP, so code defensively.
Speak your mind...