Support

Account

Home Forums ACF PRO Dynamically generate relationship multisite Reply To: Dynamically generate relationship multisite

  • So, the problem is that when the field is loading after saving the post ID values do not exist on the current site.

    When ACF renders the field it does this

    
    // get posts
    $posts = acf_get_posts(array(
             'post__in' => $field['value'],
             'post_type' => $field['post_type']
    ));
    

    the function acf_get_posts() in api-helpers.php is where you need to look. I’m not sure if you can do anything there. I think that you need to find a way to switch sites before acf renders the field and then switch back after acf renders the field. I would try this hook https://www.advancedcustomfields.com/resources/acf-render_field/, twice, low priority to switch to the main site and high priority to restore the current blog.

    again, I don’t know if it will work.