kasia-boilerplate
kasia-boilerplate copied to clipboard
WordPress entity content printed out as [object Object]
Getting the following error with the standard components in this project.
This happens because the content
and excerpt
fields are objects not strings.
{
...
"content": {
"rendered": "<p>Welcome to WordPress. This is your first post. Edit or delete it, then start writing!<\/p>\n",
"protected": false
},
...
}
Replacing calls to parse(page.content)
with parse(page.content.rendered)
and parse(page.excerpt)
with parse(page.excerpt.content)
solves that issue.
Not sure if this has anything to do with the version of the rest-api
WordPress plugin that is being used.