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


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!

    • ProxxiM

    • December 10, 2020 at 3:04 am

    I’m running into this issue as well and would love to know if it’s possible to trigger a re-render when specific fields like the post-title or featured-image have been changed, per example.

  • +1

Viewing 3 posts - 1 through 3 (of 3 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.