So we’ve built a WordPress multisite with 4 different sites setup.
We are using a parent theme, and 2 different child themes across the sites.
Recently, we’ve been doing some work on page speed and to help this we’ve switched over to using the ACF PHP config E.g. https://www.advancedcustomfields.com/resources/register-fields-via-php/.
Now because the field groups were already setup and the field groups already contain data, as well as using different field groups per site. We’ve added the PHP config to both parent theme & the child themes. Obviously using the export tool to get our code.
The problem we’re having is because we’ve added this config to the parent theme & child themes, it’s importing BOTH files for the PHP config.
So we’re getting issues where some fields are duplicated, and some fields which are displayed are not required at all. e.g fields used on the parent theme but not required for the child theme.
I can’t seem to think of any way to remove the duplicates, or to stop the custom fields on the parent theme being imported into the child themes.
I was thinking of maybe using a conditional check on the blog_id before calling to my acf_add_local_field_group functions? Would this work? Do you have any other ideas?