outlandishideas / kasia-boilerplate

:tophat: A universal application boilerplate with Kasia
MIT License
17 stars 1 forks source link

WordPress entity content printed out as [object Object] #4

Open mattKendon opened 7 years ago

mattKendon commented 7 years ago

Getting the following error with the standard components in this project.

image

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.