Support

Account

Home Forums Add-ons Gallery Field Can't get access to ACF gallery field from a 'Polylang' translated page.

Solved

Can't get access to ACF gallery field from a 'Polylang' translated page.

  • I am using ACF gallery field to create a slider to be displayed on both language versions of a page. For page translations I use ‘Polylang’ plugin.

    I can access this field, with this function:
    get_field('gallery');
    from a page with default language no problem, but wasn’t able to do it on the translated page – it returns an empty array.

    The strange part is that I can’t get gallery field from a translated page even if I use the id of the page with default language, like so:
    get_field('gallery', $page_id);

    Even more strange – I created a gallery field in ACF ‘Option page’, and have no problem to access it from page with default language, using this:
    get_field('gallery', 'options');
    But on the translated page this function still returns an empty array.

    I must say there is no problem to access any other ACF field from translated page, but only gallery field.

    Why is that gallery field have this issue, but not any other type of ACF fields?

    Edit: Calling get_field('gallery', 'options', false); on translated page returned array of image ids. Issue is probably connected with applying filters, but why only on the translated page?

  • For anyone struggling with the same bug try to turn off mediafiles translation in Polylang settings.

    Otherwise you need to provide translation for every image in Attachment Details.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Can't get access to ACF gallery field from a 'Polylang' translated page.’ is closed to new replies.