Skip to content

How to access fields of a component from a BlockPostObject component? #421

Answered by domtra
marcotiberio asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @marcotiberio ,
I do not get a full picture of your setup or what you are trying to do exactly. So I will make a couple of assumptions and try to provide a solution. Please correct if I got something wrong.

Let's say you have a page. On that page is a flexible content field. You have a component BlockArtistInfo in which you select a different post, maybe of post type artist through a ACF relationship or post_object field. And for this connected post, you want to access the meta fields.

The challenge is that when you use 'return_format' => 'object' in ACF's relation fields, it returns a regular WordPress post object. Not a TimberPost. So you cannot use the methods you are used to with T…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by steffenbew
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants