Home › Forums › Gutenberg › Gutenberg – Get values from another post › Reply To: Gutenberg – Get values from another post
I know I may be a little late to the party but I believe that I found a solution to this. Maybe something that was added to an update since last this was reviewed, but I did the following to get a specific field that is from a block on another post.
$postBlocks = parse_blocks($post->post_content);
print_r($postContent); // Displays array of all blocks
$postContent = $postBlocks[0]['attrs']['data']['custom_field_slug']; // Example
echo $postContent;
Hope you all are well,
Darren
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.