I’m getting really frustrated with this issue I am having with WP multisite.
The idea is, I have a multisite and it is here where all posts are created then just shared down to the other sites using ACF field.
Here is a part of the code where the issue happens:
switch_to_blog(1);
$person= get_posts( $args );
foreach($person as $post) {
echo get_current_blog_id(); THIS WILL DISPLAY 1
$person_info = get_field(‘person_info’, $post->ID);
echo get_current_blog_id() ; THIS WILL DISPLAY THE CURRENT SITE, THE SITE JUST GOT RESTORED
}
restore_current_blog();
There is nothing in ACF that should be causing this, ACF never calls restore_current_blog(), at least not when getting a field value. The only time ACF does this is when doing an upgrade on multisite.
I would start buy searching the code of all plugins and the theme to find places where restore_current_blog() is called. I would be looking for filters and actions that might be fired during the retrieval of the field value.
Thanks John for responding. I’ll check and look for codes that might be doing this. I’ll get update this post if I find something.