Support » Plugin: ACF Post-2-Post » Breaks Polylang Front Page

  • We are having issues with Polylang that I traced to this plugin:

    Every time we save the page that is set as the front page (any language) other translations of the front page lose their “front page” status. We need to fix this every time by resaving polylang.

    I traced it to this line in this plugin:
    acf-post2post.php:41
    add_filter(‘acf/update_value/type=post_object’, array($this, ‘update_relationship_field’), 11, 3);

    Removing that filter solves the issue. The other filter (acf/update_value/type=relationship) is fine.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author John Huebner

    (@hube2)

    That is because this plugin works with both relationship and post object fields.

    I’m assuming that you’re using an ACF field for this front page status. You can disable the post-2-post relationship on any field by adding this filter

    
    add_filter('acf/post2post/update_relationships/key=field_XXXXXXXX', '__return_false');
    

    where field_XXXXXXXX is the field key of the field you do not want this plugin to mess with.

    • This reply was modified 5 months, 3 weeks ago by John Huebner.

    Thanks for the John.

    I don’t think that filter is even relevant to the issue. Polylang doesn’t use ACF to store front page association.
    Also traced the function and only the right field type is passed to it that has nothing to do with Polylang.

    Plugin Author John Huebner

    (@hube2)

    Do you have a relationship field that is named the same as an already existing polylang field? Check the field name used by polylang for the field that is the issue against your relationship field names.

    • This reply was modified 5 months, 3 weeks ago by John Huebner.

    Nope, the fields don’t have similar names.

    Plugin Author John Huebner

    (@hube2)

    There simply isn’t any way that that I can think of that this plugin can effect any other field if it is not an ACF field.

    1st – It only fires when ACF is saving a value to an ACF field, either a relationship of a post object field.

    2nd – It looks at the post ID values being saved to the current post and it looks for a field on those posts with the same name. It uses the function acf_get_field_groups() using the post_id parameter. Then it loops though all the field in each group to find a field with the same name on that post. So only an ACF field can be found.

    The only possible way that I can see this effecting anything else is if there field on both posts with the same “meta_key” that is an ACF field.

    This plugin is rather simple, maybe you can get the devs of polylang to take a look. Maybe they can tell us both why this plugin would have any effect on this setting.

    I’m working for Polylang devs as well. I’ll update this thread. I can’t think of any relationship between these two either – It’s just so random. That’s why I opened a request.

    All I found is it’s caused by the call to acf/update_value filter in the ACF post2post plugin (in particular something inside add_relationship). But I’ll do some more research and talk to Polylang devs and update this.

    Update: I traced this to the acf_get_field_groups call inside this plugin.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.