When enabling synchronization on a relational field (a custom post type in my case) there is an error about trying to get a property of a non-object.
Trying to get property of non-object in /wp-content/plugins/polylang-sync/include/PolylangSync/Sync/ACF.php on line 390
This seems to be caused by the $posts variable inside of update_relationship() function (polylang-sync/include/PolylangSync/Sync/ACF.php line 382) only receiving the post ID instead of a post object. My ACF field is set to return "Post Object" and not only "Post ID".
To fix, I suggest adding a new line just after line 389 that is $post = get_post($post); which will pull the post object information and allow the rest of the code to run smoothly thereafter.
I have not done any further testing apart from verifying that this fix works in my particular use case. I can create a merge request if it seems an adequate fix.
Thanks, this plugin solves a problem I didn't want to tackle on my own.
When enabling synchronization on a relational field (a custom post type in my case) there is an error about trying to get a property of a non-object.
Trying to get property of non-object in /wp-content/plugins/polylang-sync/include/PolylangSync/Sync/ACF.php on line 390This seems to be caused by the
$postsvariable inside ofupdate_relationship()function (polylang-sync/include/PolylangSync/Sync/ACF.php line 382) only receiving the post ID instead of a post object. My ACF field is set to return "Post Object" and not only "Post ID".To fix, I suggest adding a new line just after line 389 that is
$post = get_post($post);which will pull the post object information and allow the rest of the code to run smoothly thereafter.I have not done any further testing apart from verifying that this fix works in my particular use case. I can create a merge request if it seems an adequate fix.
Thanks, this plugin solves a problem I didn't want to tackle on my own.