{"id":9269,"date":"2010-05-27T11:23:33","date_gmt":"2010-05-27T11:23:33","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/wp-ajax-query\/"},"modified":"2010-05-27T11:25:13","modified_gmt":"2010-05-27T11:25:13","slug":"wp-ajax-query","status":"publish","type":"plugin","link":"https:\/\/tah.wordpress.org\/plugins\/wp-ajax-query\/","author":5699178,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"0.1","stable_tag":"0.1","tested":"3","requires":"3","requires_php":"","requires_plugins":"","header_name":"WP Ajax Query","header_author":"Ezwan Aizat Bin Abdullah Faiz","header_description":"","assets_banners_color":"","last_updated":"2010-05-27 11:25:13","external_support_url":"","external_repository_url":"","donate_link":"https:\/\/www.paypal.com\/cgi-bin\/webscr?cmd=_donations&business=aizat%2efaiz%40gmail%2ecom&lc=MY&item_name=Ezwan%20Aizat%20Bin%20Abdullah%20Faiz&item_number=WP%20Ajax%20Query&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted","header_plugin_uri":"http:\/\/blog.aizatto.com\/wp-ajax-query\/","header_author_uri":"http:\/\/aizatto.com","rating":0,"author_block_rating":0,"active_installs":10,"downloads":3529,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation"],"tags":[],"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":0},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["0.1"],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[221,1118,1626,5913],"plugin_category":[59],"plugin_contributors":[80197],"plugin_business_model":[],"class_list":["post-9269","plugin","type-plugin","status-publish","hentry","plugin_tags-ajax","plugin_tags-json","plugin_tags-query","plugin_tags-wp_query","plugin_category-utilities-and-tools","plugin_contributors-aizatto","plugin_committers-aizatto"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/wp-ajax-query.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>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.<\/p>\n\n<h3>How It Works<\/h3>\n\n<p>The Ajax Query interface would be available at http:\/\/example.com\/wp-admin\/admin-ajax.php?action=query<\/p>\n\n<p>A sample jQuery request would be like:\n    $.get(ajaxurl, { action: 'query' }, function () { }, 'json');<\/p>\n\n<p>Querying for a post:\n    $.get(ajaxurl, { action: 'query', p: 1 }, function () { }, 'json');<\/p>\n\n<p>JSON results:\n    {\n      \"id\": 1,\n      \"type\": 'post',\n      \"title\": \"Hello World\",\n      \"permalink\": \"http:\\\/\\\/example.com\\\/?p=1\"\n    }<\/p>\n\n<p>Query a category:\n    $.get(ajaxurl, { action: 'query', cat: 1 }, function () { }, 'json');<\/p>\n\n<p>JSON results:\n    {\n      \"id\": 1\n      \"type\": \"category\",\n      \"permalink\": \"http:\\\/\\\/example.com\\\/?cat=1\",\n      \"terms\": [],\n      \"posts\": []\n    }<\/p>\n\n<pre><code>terms and `posts` represents an array of either terms that are sub categories of the category, or posts belonging to the category.&lt;h3&gt;Why I Created It&lt;\/h3&gt;\n<\/code><\/pre>\n\n<p>Needed a common way to query the database for posts and taxonomies across multiple plugins, and didn't find a suitable replacement.<\/p>\n\n<!--section=installation-->\n<ol>\n<li>Upload the <code>wp-ajax-query<\/code> folder into your plugin directory.<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress<\/li>\n<\/ol>","raw_excerpt":"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 respresentatio &hellip;","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tah.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/9269","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tah.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/tah.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/tah.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=9269"}],"author":[{"embeddable":true,"href":"https:\/\/tah.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/aizatto"}],"wp:attachment":[{"href":"https:\/\/tah.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=9269"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/tah.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=9269"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/tah.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=9269"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/tah.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=9269"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/tah.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=9269"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/tah.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=9269"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}