0

Is there a way to change the returned wp rest api json format? Instead of an array i'd like the response to be in an object format.

Desired format:

{
    "articles": [
        {
            "id": 160,
            "title": "This is a new post ",
            "slug": "this-is-a-new-post-faf0no",
            "author": 3,
        }
    ]
}

I didn't find any hooks related to this. Any help is appreciated. Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.