Home Forums Gutenberg Get data from block in different page


Get data from block in different page

    • mattkr

    • March 16, 2019 at 1:45 am

    is it possible to get a data from registering block field (5.8-4beta) on any page?

    For example:

    • I’ve created Block “Contact” with fields email, phone, address
    • Create page template “Contact page” and add block “Contact” and fill fields.
    • I would like to add exactly the same data to the footer (on all pages)

    Is there any option to use get_field() function and retrieve data from “Contact page”, from first block “Contact”.

    I understand I can do that by get block ID.
    get_field('contact_block', 'block_5c8b98f36c5c7');

    But if someone remove this block and add again the same block type that my code won’t work.
    Is it any way to get block ID based on page ID? (Get first block from Contact page).

  • I’m also interested in an answer to this question.

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

You must be logged in to reply to this topic.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.