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
Thanks for the response @hube2, I’m trying to understand why does it work when hooked at plugins_loaded
, though?
There’s a changelog entry for a fix on 5.7.12 that seems to intend to fix this issue:
* Fix - Fixed bug causing incorrect value retrieval after switch_to_blog().
I believe it’s related to this code:
/**
* acf_switch_stores
*
* Triggered when switching between sites on a multisite installation.
*
* @date 13/2/19
* @since 5.7.11
*
* @param int $site_id New blog ID.
* @param int prev_blog_id Prev blog ID.
* @return void
*/
function acf_switch_stores( $site_id, $prev_site_id ) {
// Loop over stores and call switch_site().
global $acf_stores;
foreach ( $acf_stores as $store ) {
$store->switch_site( $site_id, $prev_site_id );
}
}
add_action( 'switch_blog', 'acf_switch_stores', 10, 2 );
So the ACF Stores would format the values when retrieving it with get_field, which is exactly what I need. But I don’t understand why that works in plugins_loaded, but not in filters like acf/load_field/name=
and acf/pre_submit_form
.
Does that make sense?
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.