‘Preview Changes’ for custom meta boxes?

How can I have the ‘Preview Changes’ working for custom meta boxes? For instance, I just want to test/ preview some text in a custom meta box but I don’t want to save/ update because that post/ page is already gone live.

eg:

    $post_id = $post->ID;

    $meta = get_post_meta( get_the_ID(), 'meta_tile1_text', TRUE );
    var_dump($meta);
    ?>
    <p><?php echo $meta;?> </p>

This only works when I click ‘Update’ button in the backend. But it does not when I click ‘Preview Changes’. I have to save the ‘preview’ text in order to see it.

Is it possible?

1
1

Are you using or do you have gutenberg enabled? If so is it up to date?

If not can you please let us know what theme if any and what editor if any.

There is a well known bug that seems to show it’s face if you are using gutenberg. It was meant to have been fixed (please make sure your wordpress and gutenberg are up to date) however there are recent reports this could still be an issue:

Original report and confirmed bug here: https://github.com/WordPress/gutenberg/issues/11280

Confirmed bug fixed here: https://github.com/WordPress/gutenberg/pull/11409

Leave a Comment