问题描述
我看到 WordPress.com 最近开始使用 Gutenberg,它依赖于 WP REST API.我正在构建一个插件,我想使用来自自托管站点的 WP REST API,并让它与 WordPress.com 站点通信,但我无法找到 REST API 基本 URL.例如,https://cmljnelson.wordpress.com/wp-json
是 404.
进一步阅读:
I see WordPress.com recently started using Gutenberg, which relies on the WP REST API.I'm building a plugin and I'd like to use the WP REST API from a self-hosted site, and have it communicate with a WordPress.com site, but I'm having trouble finding the REST API base URL.For example, https://cmljnelson.wordpress.com/wp-json
is a 404. The documentation about REST API discovery doesn't seem to apply to WordPress.com.How can I find the WP REST API base URL for WordPress.com sites?
WordPress.com's REST API apparently is shared among sites hosted there and you can access it here: https://public-api.wordpress.com/wp/v2/.
If you want access to the REST routes of a specific site in WordPress.com, use the /sites
route:
https://public-api.wordpress.com/wp/v2/sites/{site-id or domain}/
Further reading:
这篇关于如何访问 WordPress.com 站点的 WP REST API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!