Support

Account

Home Forums Gutenberg Is it possible to trigger a block refresh?

Unread

Is it possible to trigger a block refresh?

    • keoshi

    • November 16, 2019 at 12:40 am

    Hi all,

    What I’m trying to do is getting post custom fields to auto-populate an ACF Gutenberg block added to the editor. I’ve managed to do some of that with this snippet and then fetching meta with the $post_id.

    // Get post ID in preview mode
    if ( $is_preview ) {
    	$post_id = $_POST['post_id'];
    }

    This means the block is not immediately updated when the post meta is changed obviously, but nor is the preview refreshed when the post is saved (because it doesn’t refresh the page).

    So I wonder if it’s possible at all to trigger a block refresh when a post custom field is updated, as it happens with ACF Gutenberg blocks.

    I understand saving post meta directly from blocks as suggested in acf/issues/83 would cleverly solve this, but any pointers are welcome.

    Thanks in advance!

Viewing 1 post (of 1 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.