Support

Account

Home Forums General Issues ACF Pro Relationship field custom post types filtered by Polylang after save

Solving

ACF Pro Relationship field custom post types filtered by Polylang after save

  • I’m posting here to document specific behavior of ACF Pro + Polylang Pro that I ran into.

    I’ve been working through an issue with the ACF relationship field that I’ve noticed back in September and has persisted through the latest updates.

    Data returned for the relationship field didn’t display after save for some post types.
    I have various post types (e.g. project and lecture). After saving the post their IDs are saved seemingly correct in wp_post_meta.

    In wp_post_meta I saw e.g.:
    a:2:{i:0;s:5:"33694";i:1;s:5:"29094";}
    IDs of respectively a project and a lectureem>.

    However, only certain post types would then show up after the reload of the post edit page or front-end (project shows, lecture didn’t).
    They appeared to be loaded from the database incorrectly.

    Digging further, it appeared this was caused by Polylang Pro.

    The project post was marked for translation. The lecture post type wasn’t.
    Additionally, after marking the lecture post type for translation, I then had to apply the default language to the existing posts manually (through bulk edit).
    Only then would the
    lecture posts show in post edit and on the front-end.

    In my opinion the possibility to select untranslated posts in the relationship field, that subsequently are filtered away when getting the field values, because they do not match the current language, is confusing behaviour. I’ve contacted Polylang Pro Support to let them know about this.

    I’ve seen similar issues, though without details on the usage of a multilingual plugin, in:
    * https://support.advancedcustomfields.com/forums/topic/relationship-data-not-saving-for-custom-post-type/ (Relationship data not saving for custom post type)
    * https://support.advancedcustomfields.com/forums/topic/relationship-field-issues-with-specific-post-type (Relationship field issues with specific post type)

    For more context, it appears some values for the relationship field are not saved. In this case, however, data for the relationship was saved, but the display of that data seems to be filtered by Polylang Pro, so that the saved values are incomplete or missing on reload. Wether the data is saved correctly can be checked in the wp_post_meta table as described above.

    Let me know if you need any further details.

    Keep up the good work!

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.