Support

Account

Home Forums ACF PRO JSON sync in multisite Reply To: JSON sync in multisite

  • I don’t get how currently what I do works and copied changes from site to site are isolated between database tables but when you apply json sync it overwrites due to the field groups being the same.

    The files saved in the json folder reflect whatever you saved last. If two sites are using the same folder then they both pull from those last saved changes. This is based on the field group key. Two sites with the same field groups but that have different fields in them cannot share a folder.

    It appears you have more control over manually copying and then modifying/removing field groups between sites from the out of the box database way than using json sync. I guess this is because ACF is not built in mind for multisite and any solutions for multisite are work arounds.

    Yes. Basically, when using ACF on multisite you have completely different db entries. If the sites share a theme and you attempt to use local json then basically, you can only have to sites with identical field groups and fields. As you say, having two sites with the same theme requires work-a-rounds.

    My guess is that when the site was built was assumed that all sites would use the same fields and at some point along the way this assumption was proven false and the developer did what he needed to to make it work. Changing requirements usually result it this happening. I’m having a similar situation myself.

    I actually didn’t think about this site until I read your reply.

    I have a site that was originally built as a single site installation. It was then converted to mutlisite because the client wanted to add additional sites using the same theme. Unfortunately, this means that all the field groups need to be copied to every new site. I was already using local json so that wasn’t really an issue. Since the fields were not in the DB for the new site it just used the json files from the theme. Then, what has you are seeing I had to start making “adjustments” to the fields for each site. This has resulted in needing to add many filters to adjust fields for the different sites. In this case I have created an options page for each site. This options page contains a list of fields that need to be changed. Each field on the options page includes setting for “should the field be shown”, and the field “label” to use for each site and in some cases what the values of the field can be. The I use the acf/load_field to modify the field. I also use the acf/prepare_field filter to remove fields from specific sites where that is needed. On top of this all of the templates on the front end need to have additional checks added to see if a particular field should be shown or not. This results in giving me the ability to work on all of the field groups in the main site and be able to adjust those fields as needed for every other site. Every time I have to make an adjustment I have to also make adjustments to the options page and the filters. It’s all very complicated and the complication has grown over an extended period of time. I can’t imagine what the next developer will do when they inherit this site.