About this plugin
WP Ajax Query allows you to query your WordPress database using the same query paramaters you would use for WP_Query, and return a JSON respresentation of the query results. This allows developers to easily interface with WordPress without having to relearn a new API.
How It Works
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”,
p=1”
}
Query a category:
get(ajaxurl, { action: ‘query’, cat: 1 }, function () { }, ‘json’);
JSON results:
{
“id”: 1
“type”: “category”,
cat=1”,
“terms”: [],
“posts”: []
}
<h3>Why I Created It</h3>
Needed a common way to query the database for posts and taxonomies across multiple plugins, and didn’t find a suitable replacement.