Plugin Directory

WP Ajax Query

Allow you to query the WordPress database and retrieve a JSON response

How It Works

The Ajax Query interface would be available at http://example.com/wp-admin/admin-ajax.php?action=query

A sample jQuery request would be like: $.get(ajaxurl, { action: 'query' }, function () { }, 'json');

Querying for a post: $.get(ajaxurl, { action: 'query', p: 1 }, function () { }, 'json');

JSON results: { "id": 1, "type": 'post', "title": "Hello World", "permalink": "http:\/\/example.com\/?p=1" }

Query a category: $.get(ajaxurl, { action: 'query', cat: 1 }, function () { }, 'json');

JSON results: { "id": 1 "type": "category", "permalink": "http:\/\/example.com\/?cat=1", "terms": [], "posts": [] }

terms and `posts` represents an array of either terms that are sub categories of the category, or posts belonging to the category.

Why I Created It

Needed a common way to query the database for posts and taxonomies across multiple plugins, and didn't find a suitable replacement.

Requires: 3 or higher
Compatible up to: 3.0.5
Last Updated: 2010-5-27
Downloads: 1,484

Average Rating

5 stars
(2 ratings)

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

0,1,0