我试图通过使用WP REST API获取ID的所有帖子。根据文档,我们可以使用过滤器来使用WP Query参数。使用此帖子结束点将返回所有帖子。
http://demo.wp-api.org/wp-json/wp/v2/posts/?filter[posts__in]=470,469
答案 0 :(得分:10)
使用V2这对我有用,更多的黄油然后添加自定义代码
bin/zookeeper-server-start.sh config/server.properties
[2018-03-17 03:27:11,623] INFO Reading configuration from: config/server.properties (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2018-03-17 03:27:11,628] ERROR Invalid config, exiting abnormally (org.apache.zookeeper.server.quorum.QuorumPeerMain)
org.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Error processing config/server.properties
at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:154)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:101)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:78)
Caused by: java.lang.NumberFormatException: For input string: "initial.rebalance.delay.ms"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Long.parseLong(Long.java:589)
at java.lang.Long.parseLong(Long.java:631)
at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parseProperties(QuorumPeerConfig.java:242)
at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:150)
... 2 more
Invalid config, exiting abnormally
答案 1 :(得分:4)
对于WP REST API的v2,请使用以下格式 -
>>
如果您想要自定义编码,
您可以按ID
检索单个帖子boost::spirit
但是根据支持,它不适用于多个帖子。
http://demo.wp-api.org/wp-json/wp/v2/posts?include[]=470&include[]=469
所以你可以运行循环并逐个获取。
但是对于多个你必须放一个函数
http://demo.wp-api.org/wp-json/wp/v2/posts/?filter[p]=470
然后你必须运行
https://github.com/WP-API/WP-API/issues/1368