Home Forums General Issues How to add data to returned Post Object ?


How to add data to returned Post Object ?

  • Hello,

    I’m using ACF in a headless wordpress project (rest API).

    I have a custom post type “article” using an ACF flexible layout, in which you can add a cover image.

    I want to display a list of selected articles, which you can select using the “Post Type” field.

    This returns a Post Object with most of the informations i need, however i would also like this Post Object to return the cover img URL.

    How can i add the ACF field “cover image” to the returned Post Object ?

  • found a way by adding a custom hook inside ACF plugin to filter post object before it is returned
    not super clean, but it works

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.