Support

Account

Home Forums Backend Issues (wp-admin) Keep custom fields inside specific site/child theme in multisite

Solved

Keep custom fields inside specific site/child theme in multisite

  • Hi there,

    I’ve got ACF (Pro) installed on a multisite, which has a custom parent theme with some custom child themes on a couple of the satellite site.

    Under the main site I’ve got some custom fields installed and showing up on every site (intended), however I’ve also created some custom fields on the satellite site (which is using a child theme), and the fields created there are showing up on all other satellite sites, and across other child themes (not intended).

    Is there a way to keep the custom fields which are created specifically on one satellite site (and child theme) only showing up there?

    Some other details:

    • Having the acf-json folder doesn’t appear to matter regarding the fields showing up
    • The custom fields will show in the backend on the post page for all sites, however looking under ACF’s field editor (Custom Fields) will not show the field group created on the other satellite site/child theme. If the site where the custom field was created has an acf-json folder, it’ll show that file as available for syncing
  • Found this related question (after relentlessly changing search parameters):
    https://support.advancedcustomfields.com/forums/topic/multisite-location-rules-display-field-groups-on-specific-sites/ and got my answer in the question, didn’t even know rule matching filters existed!

    My sites live on subdomains, so I preferred to change the display list to use the blog (site) name rather than either their subdomain or path (mine were all “/”), so in the acf_location_rule_values_multisites function, I changed the the loop to show names instead.

    foreach( $sites as $site ) {
         $name = get_blog_details( array( 'blog_id' => $site->blog_id ) )->blogname;
         $choices[ get_object_vars($site)["blog_id"] ] = $name;
    }

    Note I put this function in the parent theme, child theme alone would’ve prevented it showing on other satellite sites not using the same child theme.

    I’m still choosing to make the field groups on each satellite site, though they are appearing available to sync on all the other satellite sites, though I can either just hit sync and have them all in (which shouldn’t matter since they’ll only show on the correct site anyway) or ignore them when syncing everything else to keep it clean).

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.