WordPress API – Getting just post content

Question

I am trying to get the content from a wordpress page into a file. Is there a way to do this with the API? When I try to use the API, it returns all the content in html instead of text, and I just want the text (and maybe a way to try to remember which pictures were with each page but that’s not as important)

“my-site.com/wp-json/wp/v2/pages” gives

"content": {
"rendered": "<h1 style="text-align:center;whi ..."

is there a way to get the content, not html, in an unrendered format?

I have tried setting the context to “edit” through query params (?context=edit) and also passed through this wrapper along with basic password authentication: https://github.com/WP-API/Basic-Auth.The wrapper works fine but whenever I try to set the context to edit instead of view, it gives me a 401 error. Any ideas what to try?

0
Marc Sloth Eastman 3 months 2021-05-04T00:46:04-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse