Support

Account

Home Forums General Issues switch_to_blog problem with Wpml

Helping

switch_to_blog problem with Wpml

  • hello, i’m using the following code to retrive informations from other sites in our multisite installations.


    switch_to_blog(2);
    $my_field = get_field('my_field', 'option');
    restore_current_blog();

    The website executing the code has WPML installed.
    Surprisingly the code above works fine if called from the main language of the site, but returns null if called from a page in different language
    eg: works if called from /siteX/ but not if called from /siteX/es/

    Do you know any solution for this?
    Thanks!
    Al

  • This is old, but my guess would be that blog 2 does not have an ACF field group associated with the language that contains the field you are attempting to get.

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

You must be logged in to reply to this topic.