Skip to content

Post_Template_Condition preventing post meta revision saving and breaking preview #829

@joeyblake

Description

@joeyblake

Version

  • Carbon Fields: 3.1.3
  • WordPress: 5.3.2
  • PHP: 7.3
  • Editor: Classic Editor

Expected Behavior

Using the classic editor with some fields that have post_template conditionals I should be able to click the preview button and see any updated fields in the post preview.

Actual Behavior

Post previews will show no carbonfields metadata at all.

Container definition

add_action( 'carbon_fields_register_fields', 'register_homepage_blocks' );
function register_homepage_blocks() {
	Container::make( 'post_meta', 'Homepage Blocks' )
		->where( 'post_template', '=', 'homepage-layout.php' )
		->set_context( 'normal' )
    ->add_fields([
				Field::make('text', 'my_test_field', 'Test field label' )
    ]);
}

Steps to Reproduce the Problem

  1. add code to homepage-layout.php template to output carbonfield data.
  2. update carbonfield data
  3. View preview, see carbonfield data not output

Comments

I'll have a PR for this in a few minutes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions