Home Forums Backend Issues (wp-admin) Multisite ACF


Multisite ACF

  • So far I’ve been using export php option and including that file in functions.php for my multisite so all instances can make use of the custom fields.

    But since this does not actually create the custom field on the instances (except on the main one where I create them), this is causing some issues with other plugins such as Advanced Custom Search plugin that checks the field groups created on an instance to show its search fields.

    My question is, how can I make sure the field groups are created on all multi site instances and they are all in sync with the main site?

    What other things do I need to know and consider?

  • If all of the sites are using the same theme then you simply need to add the acf-json folder to the theme on the main site. If they are using different themes instead of using PHP you can add a JSON load point to the theme used on the main site.

  • @hube2 Yes, all sites use the same theme. From that local json page, it seems like I have to manually sync on each site? Is there a way to automate syncing?

    From my use case, I have one template site where I make all the changes to the fields, once I save any changes, I want them to be automatically synced to all sites in my network.

  • No, you do not need to sync the files.

    You edit a field group on the main site. The field group will never appear on the sub site to be edited and you would never edit them here. The existence of the group in the acf-json folder is all that is required, they will be loaded and used from there. If you are never going to edit the field groups on one of the sub sites then adding them to the database would be a waste of space. Using the same theme they will be already “synced”

  • @hube2 Perfect! thank you. I will test it out now and report back here.

  • One thing I forgot to mention. The main site uses a different theme (because I need different custom fields there), however all other sites use a common theme. Is that going to be a problem?

  • It did not work. The json file is being generated fine, but nothing is syncing automatically. I don’t see any custom fields on all other sites except the one I am creating them on (which has the same theme as others)

  • Not sure that I follow. but this will only work if all of the sites use the same them and all of the same custom fields. If there are differences in the fields then you can’t really use this method.

    Basically, what you need to have is one site that uses all of the fields that all of the other sites using the same theme will use where you edit the fields that will be used on those sites.

  • Another option is to copy the JSON files from the theme where you are creating them to the acf-json folder in the theme where you want to use them.

  • This is my setup:

    Main site – different theme, different fields (used for admin purpose only)
    All sub-sites – same theme, same fields (used by clients)

    One of my sub-sites is called a “template” site where I make all pre-defined changes I want to replicate on all other sub-sites.

    I am not doing anything on the main site for this. I am just using the template site where all the custom fields are created in the dashboard. I created acf-json folder in the theme folder which is shared by all other sites.

    I made changes to all my field groups and I see a json file being created for each group. On all other sites, I see “Sync Available” tab in custom fields page. Is there a way to automatically sync it? That’s what I am asking.

  • You don’t need to sync them. The JSON files will be used everywhere except for editing them. If no one is going to edit these field groups on any of the other sites then syncing can be ignored.

    If I was going to do something similar, this is what I would do, however, parts of the sites may not work during the process, so it really depends on how many of these sites you have.


    1) I would go into all of the other sites (all of the sites except the main site where you plan on editing these field groups) and I would delete all of the field groups from ACF. This will also cause your JSON files to be deleted, meaning that the fields will not appear on these sites until you do step 2

    2) Go back into the main site where you want to edit the groups and update each field group so that the JSON file is re-saved.

    With that done you will have only one place where you can edit fields and those fields will be used on all sites using the same theme.

  • I did just that. I updated each field group on the main site where I edit the fields and I see all json files generated in the acf json folder. I went into each site and this is what I see:

    There no custom fields defined in any of the other sites. They have not synced or registered with all other sites.

  • I would just ignore it. There is no reason to sync the DB with the JSON files.

  • So then what’s the difference between using JSON and PHP?

  • I never noticed it before, I guess when I’ve done this I’ve never looked at the ACF admin on the secondary sites because I never planned on editing fields there.

    There is one way to solve this, but you’ll need to do it every time you edit a field group. You need to edit the JSON file. The end of the file will look something like this

    "active": 1,
    "description": ""
    "modified": 1558547253

    and you need to add a line

    "active": 1,
    "description": ""
    "modified": 1558547253,
    "private": true

    but like I said, you need to edit the file every time you update it on the main site

  • Interesting. It might be difficult to edit multiple JSON files everytime I make changes. What about PHP export file that will just be one file so its easier to edit. What can I add to it to make them show up in ACF admin on secondary sites?

    I don’t plan to edit them either on the secondary sites (I have hidden that menu).

  • Adding "private": true just hides the fieldgroup from the Sync Available tab and does not show it in the All tab. Other code or plugins that need to access the field groups are not being able to access them.

  • The whole reason to do this is to not edit them on the sub sites. All field groups added this way should be accessible to anything that needs them. The field groups exist the same as they would exist if loaded from the DB. The only difference is where they are loaded from. If there is some code that cannot access them you’d need to give me more details on this because that should not be the case. If other plugins cannot access the field it’s likely because they are not doing it properly.

  • This reply has been marked as private.
  • If it is supposed to work with ACF I would contact them and ask why it’s not working with ACF local JSON feature. This feature was not available in ACF4 and ACF5 was just recently released as a free version. Maybe that’s the problem. I can’t say. But if this plugin needs to be used and you need to sync the fields on all sites then there isn’t an automatic way of doing this or causing ACF to do it.

  • Thanks John. I will contact them about it. This plugin hasn’t been updated since a year now. Maybe they have not added support for it.

    For now I will use this instead – a modified version of the sync json acf plugin.

    Only major down side of this is that it creates the fields in the database for each sub site which is what we are trying to avoid for performance reasons.

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

The topic ‘Multisite ACF’ is closed to new replies.