Support

Account

Home Forums Bug Reports Fields on acf/pre_submit_form does not receive format_values treatment Reply To: Fields on acf/pre_submit_form does not receive format_values treatment

  • @hube2 That makes sense, thank you.

    I understand that the value formatting (eg: return Both) comes from the ACF Store “Values”, therefore the function acf_switch_stores being called on switch_blog should update ACF Stores to point to the multi-site instance after the switch.

    So, this is what I think is happening:

    1. Request starts at main site
    2. ACF initializes naturally, which triggers acf_register_store('values')
    3. I run switch_to_blog(2) on the context of filtering a field value, which fires the hook acf_switch_stores
    4. ACF switches to that multisite instance store, but the store isn’t initialized in this site instance, so the values store is empty

    It works at plugins_loaded because:

    1. Request starts at main site
    2. On plugins_loaded, I call switch_to_blog and then get_field, which internally calls ACF->initialize() on the context of the switched multi-site instance, therefore initializing the stores on the context of that site instance

    Would it make sense for ACF to register the stores again on the acf_switch_stores function, if they are not registered yet?