Hello,
I am creating this discussion and topic as there is an annoying piece of a puzzle that I cannot seem to solve at this moment.
It has to do with Multisite and ACF Repeater Fields.
If there are repeater fields in the options pages or maybe in posts too, trying to switch_to_blog
into the main blog doesn’t return any arrays or values but rather just a number that seems to just give the number of rows.
So this:
switch_to_blog( 1 );
$custom_styles = get_field('custom_styles', 'option');
var_dump($custom_styles);
restore_current_blog();
Gives:
array(3) { [0]=> array(3) { ["custom_style_name"]=> string(4) "Blin" ["custom_style_class"]=> string(4) "blin" ["custom_style_css"]=> string(37) "background-color: #fff; color: #000;" } [1]=> array(3) { ["custom_style_name"]=> string(4) "Blin" ["custom_style_class"]=> string(4) "Blin" ["custom_style_css"]=> string(37) "background-color: #fff; color: #000;" } [2]=> array(3) { ["custom_style_name"]=> string(4) "Blin" ["custom_style_class"]=> string(4) "Blin" ["custom_style_css"]=> string(37) "background-color: #fff; color: #000;" } }
When on the main blog aka id 1.
And on a subsite the value given is:
string(1) "3"
Any other field that is just a single piece of info does not have a problem. So Group has the same thing.
The ACF Field exists on both sites and the key is the same.
Thank you. 🙏🏼