简体   繁体   中英

Can't get json data from Wordpress API

I've just made a website in wordpress and I want to build the front end in React.

From reading online I should be able to access the json data with this url -

yoursite.com/wp-json/wp/v2

My site is siobhanpotter.wordpress.com so I added -

https://siobhanpotter.wordpress.com/wp-json/wp/v2/posts

but it doesn't go to the json, it just takes you to my site and says the page cant be found.

Any one know what the problem is?

Your site is wordpress.com which is different from the "original" WordPress.

See: https://developer.wordpress.com/docs/api/ "If you're looking for the WordPress REST API that shipped as part of WordPress core in version 4.7, see its documentation. Note that this API is also enabled on WordPress.com, but the URL structure on WordPress.com is slightly different than for self-hosted sites. See this post for more details." ==> https://developer.wordpress.com/2016/11/11/wordpress-rest-api-on-wordpress-com/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM