Support » Developing with WordPress » 4.7 REST API returns “meta” as array instead of object

  • Our blog was updated from 4.6.5 to 4.7.4 recently. 4.7 included the REST API, which we had been using in it’s plugin form. However, after updating we noticed an issue with how it was reporting meta information when querying for posts and tags. Previously, meta was returned as an object (and documentation says it should be this way). However, after upgrading, meta was being returned as an array. This was a subtle change, but enough to break some of our code. We downgraded again, and everything is back to normal for the time being.

    My question is: Is this change a bug, or is this intended? I feel like it’s a bug, since the documentation states that meta should be returned as an object. It may just be that the documentation has not been updated though. An answer to this question will inform us on whether we should wait until it has been resolved to update WP again (bug) or if we need to change our code to look for an array rather than an object (intended).

    Additionally, I notice that 4.7.5 has an update regarding “Improper handling of post meta data values in the XML-RPC API”. Is that related? I don’t really know what that means and am having trouble finding more details around it. I would rather be sure before upgrading and risk breaking code again.

  • You must be logged in to reply to this topic.