首页 文章

WordPress acf-to-rest-api && Rest API

提问于
浏览
1

激活ACF到REST API,打破WP REST API

如果我激活WP REST API,我可以检索数据:(当前都在网站上启用,因此链接将显示错误)

http://ecommerce-ux.london/wp-json/wp/v2/posts?slug=hello-world

http://ecommerce-ux.london/wp-json/wp/v2/posts/1

当前的错误响应是


<b>Fatal error</b>: Using $this when not in object context in <b>/home/commercect/public_html/wp-content/plugins/acf-to-rest-api-master/v3/lib/endpoints/class-acf-to-rest-api-controller.php</b> on line <b>54</b>

以上链接不起作用,但如果我这样做:http://ecommerce-ux.london/wp-json/wp/v2它给我api电话 .

因为我需要为我的单个帖子页面检索自定义字段,所以我将ACF设置为Rest API,但这会破坏我的wp / 2插件的 endpoints ,我无法再检索数据,但ACF确实有效:

http://ecommerce-ux.london/wp-json/acf/v3/posts/1

回应是

{"acf":{"":false,"anchor":[{"anchor_name":"Heading","anchor_link":"heading-name"}]}}

插件

WP REST API 用于WordPress版本2.0-beta15的基于SON的REST API |由WP REST API团队http://v2.wp-api.org/

ACF to REST API 版本3.0.1-beta |作者:AiresGonçalves| https://github.com/airesvsg/acf-to-rest-api

有谁知道这项工作?

enter image description here

1 回答

相关问题