{"id":42254,"date":"2016-03-01T09:44:38","date_gmt":"2016-03-01T09:44:38","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/date-query-enabler\/"},"modified":"2016-02-28T15:36:53","modified_gmt":"2016-02-28T15:36:53","slug":"date-query-enabler","status":"publish","type":"plugin","link":"https:\/\/pt-ao.wordpress.org\/plugins\/date-query-enabler\/","author":14805527,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"0.1","stable_tag":"trunk","tested":"4.3.34","requires":"","requires_php":"","requires_plugins":"","header_name":"date_query enabler","header_author":"Ariel Kogan","header_description":"","assets_banners_color":"","last_updated":"2016-02-28 15:36:53","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"http:\/\/www.fxempire.com","header_author_uri":"http:\/\/www.fxempire.com","rating":5,"author_block_rating":0,"active_installs":10,"downloads":1590,"num_ratings":2,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","changelog"],"tags":[],"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":"2"},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":[],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[1556,2299],"plugin_category":[],"plugin_contributors":[95693],"plugin_business_model":[],"class_list":["post-42254","plugin","type-plugin","status-publish","hentry","plugin_tags-api","plugin_tags-rest","plugin_contributors-arikogan","plugin_committers-arikogan"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/date-query-enabler.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p><a href=\"http:\/\/v2.wp-api.org\/\">WP REST API<\/a> plugin provides the ability to interact with a WordPress installation through a REST API. When retrieving posts, a use case would be to filter them based on they publish date by before\/after a certain date. In WordPress this can be achieved using the <a href=\"http:\/\/codex.wordpress.org\/Class_Reference\/WP_Query#Date_Parameters\">date_query<\/a> parameter. However, the parameter is not part of the whitelisted parameters of WP REST API. A workaround is to add it ourselves as discussed <a href=\"https:\/\/github.com\/WP-API\/WP-API\/issues\/389\">here<\/a>. This plugin adds the date_query param to the whitelist not modifying the theme of WordPress but by using a very small and simple plugin. This allows to change and upgrade themes freely and still keep the whitelisting of the parameter.<\/p>\n\n<p>After installing WP REST API and this plugin, you should be able to run queries like the below,<\/p>\n\n<pre><code>\/wp-json\/wp\/v2\/posts?filter[date_query][after]=2016-02-26T12:38:36\n\/wp-json\/wp\/v2\/posts?filter[date_query][before]=2016-02-27T14:28:15\n<\/code><\/pre>\n\n<!--section=installation-->\n<ol>\n<li>Upload the plugin files to the <code>\/wp-content\/plugins\/date_query<\/code> directory, or install the plugin through the WordPress plugins screen directly.<\/li>\n<li>Activate the plugin through the 'Plugins' screen in WordPress<\/li>\n<\/ol>\n\n<!--section=changelog-->\n<h4>0.1<\/h4>\n\n<ul>\n<li>First version.<\/li>\n<\/ul>","raw_excerpt":"A plugin to add date_query to the list of allowed filters for the REST API so we can filter by date after\/before.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/pt-ao.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/42254","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pt-ao.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/pt-ao.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/pt-ao.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=42254"}],"author":[{"embeddable":true,"href":"https:\/\/pt-ao.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/arikogan"}],"wp:attachment":[{"href":"https:\/\/pt-ao.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=42254"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/pt-ao.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=42254"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/pt-ao.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=42254"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/pt-ao.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=42254"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/pt-ao.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=42254"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/pt-ao.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=42254"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}