Support

Account

Home Forums Front-end Issues Select2 not pulling saved values on MultiSite Reply To: Select2 not pulling saved values on MultiSite

  • I think you just shot over my ability to help you here, but I will give it a go.

    I suspect that it is something to do with getting values from the root site and switching sites…… but I’m not sure

    Another guess is that it may have something to do with the taxonomy/term not existing on the sub site. When ACF attempts to get the term/value for the current post it’s not finding any and the result is that the value is cleared in the admin, but I cannot be sure. I really suspect that this is the case, ACF does not know what to set the value to when the page is loaded. If this is the case, I’m not sure there is a way to fix it. You might be able to use the acf/load_value hook to attempt to…

    You’ll have to excuse the rambling of this post, I’m doing some digging through the code figure it out as I go.

    When ACF loads the value of the field it does

    
    $value = acf_get_valid_terms($value, $field['taxonomy']);
    

    This reads through all the terms that have been set to see if it’s a valid term, if not they are removed. So this where you’re problem is.

    Going back to what I said, you may be able to correct this by adding an acf/load_value filter https://www.advancedcustomfields.com/resources/acf-load_value/. Set the priority > 10 so it runs after ACf and then reset the correct values. In your filter you will likely need to use get_post_meta() to get the current value of the field because you will need to completely bypass ACF in order to avoid ACF’s check for valid terms.