Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post_Template_Condition preventing post meta revision saving and breaking preview #829

Closed
joeyblake opened this issue Jan 24, 2020 · 1 comment · Fixed by #879 · May be fixed by #830
Closed

Post_Template_Condition preventing post meta revision saving and breaking preview #829

joeyblake opened this issue Jan 24, 2020 · 1 comment · Fixed by #879 · May be fixed by #830

Comments

@joeyblake
Copy link
Contributor

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.

joeyblake added a commit to Knucklepuck/carbon-fields that referenced this issue Jan 24, 2020
… set.

Post_Template_Condition.php checks for existence of _wp_page_template in post_meta before saving. When the post is a revision there may not be a post_meta entry for _wp_page_template, so we need to check the parent post to ensure revision metadata is saved.

Fixes htmlburger#829
@jorostoyanov
Copy link
Contributor

Fixed in #879

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants