7

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
    Current WP flow allows full preview (with updated fields without saving) only for posts in status 'draft'. Published posts do not have full preview. Additional code can be applied with a hook but this code will be complicated. – Serkan Algur Dec 21 '17 at 23:20
0

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.