Skip to content

Relationship field gets emptied when using 'Preview' of a post #39

@atomtigerzoo

Description

@atomtigerzoo

Hi!
I have a hard time to reproduce this bug. We have a 1to1 relationship between a post and a custom typ post. It works correctly, so that when one side saves/updates/deletes the relationship, it gets updated inside the other post. So far so good 👍

But when saving and previewing the post a few times the relationship field in the backend (and so the database) will get emptied and the relationship is deleted. Most times it will happen when we have post already written and saved (published or outstanding doesnt matter) and the use the 'Preview' button of Wordpress. Not every time, but sometimes.

I tried to debug the saving process somehow, but cannot find out how and where this could happen or fail 🤷‍♀️

Any ideas what could be buggy or goes wrong?

Fields have the same name, both are top level and not nested inside repeaters/flexibles. Latest WP, latest ACF, latest P2P. Just using this filter to overwrite values because we only use one (from the docs):

add_filter('acf-post2post/overwrite-settings', function($settings) {
  $settings['product_test_relationship'] = [
    'overwrite' => true,
    'type' => 'first'
  ];
  return $settings;
});```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions