AI助手支持GPT4.0
WP REST API plugin provides the ability to interact with a WordPress installation through a REST API.
WP REST API 插件提供了通过REST API与WordPress安装进行交互的功能。
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 date_query parameter.
在WordPress中,可以使用 date_query 参数来实现。
However, the parameter is not part of the whitelisted parameters of WP REST API.
但是,该参数不是WP REST API列入白名单的参数的一部分。
A workaround is to add it ourselves as discussed here.
一种解决方法是按照此处所述将其自己添加。
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.
该插件将date_query参数添加到白名单中,而不会修改WordPress的主题,而是使用一个非常小而简单的插件。
This allows to change and upgrade themes freely and still keep the whitelisting of the parameter.
这样一来,就可以自由更改和升级主题,并且仍将参数列入白名单。 p>
After installing WP REST API and this plugin, you should be able to run queries like the below,
在安装WP REST API和此插件之后,您应该能够运行以下查询, p>
/wp-json/wp/v2/posts?filter[date_query][after]=2016-02-26T12:38:36 / wp-json / wp / v2 / posts?filter [date_query] [after] = 2016-02-26T12:38:36/wp-json/wp/v2/posts?filter[date_query][before]=2016-02-27T14:28:15/ wp-json / wp / v2 / posts?filter [date_query] [之前] = 2016-02-27T14:28:15 code> pre>
/ wp-json / wp / v2 / posts?filter [date_query] [after] = 2016-02-26T12:38:36/wp-json/wp/v2/posts?filter[date_query][before]=2016-02-27T14:28:15/ wp-json / wp / v2 / posts?filter [date_query] [之前] = 2016-02-27T14:28:15
/wp-json/wp/v2/posts?filter[date_query][before]=2016-02-27T14:28:15
/ wp-json / wp / v2 / posts?filter [date_query] [之前] = 2016-02-27T14:28:15
code> pre>
/wp-content/plugins/date_query
/ wp-content / plugins / date_query code>目录,或直接通过WordPress插件屏幕安装插件。 li>Activate the plugin through the ‘Plugins’ screen in WordPress通过WordPress中的“插件”屏幕激活插件 li>
ol>
原文出处:http://www.sanshu.cn/a/10245.html
群主管理都是支付大佬