Support

Account

Home Forums General Issues Problem syncing w. acf-json

Solving

Problem syncing w. acf-json

  • Hi – Using ACF Pro 5.3.8.1 — I’m testing the acf-json autoload, but when I put a JSON Field Group def file in my theme’s acf-json directory, I DO see ‘Sync Available (1)’, but the title is ‘group_5746b5997684c.json’, ‘Fields’ = 0, and Syncing results in an empty new Field Group – ‘(No Title)’, with no fields.

    Maybe my process is wrong? I’ve tried with several different Field Group defs, but my example approach is:

    1) Create a new Field Group with the Admin/Field Groups interface – call it ‘Test Group’; add a couple of fields.

    2) Use Tools/Export to export the Field Group to ‘test-field-group.json’ file OUTSIDE my WP root.

    3) Delete the ‘Test Group’ Field Group via the Admin/Field Groups interface AND empty the trash.

    4) Edit the exported JSON file, change all the keys, change the title to ‘Test Group Sync’

    5) Copy the edited JSON file to [mytheme_dir]/acf-json

    6) Reload the Admin/Field Groups tab. Can see ‘Sync Available (1)’, but problem as above.

    Am I misunderstanding how it is supposed to work? The content of the JSON file is:

    
    
    [
        {
            "key": "group_5746a271a9431",
            "title": "Test Group Sync",
            "fields": [
                {
                    "key": "field_5736a27c1fbcc",
                    "label": "Test Field",
                    "name": "test_field",
                    "type": "text",
                    "instructions": "",
                    "required": 0,
                    "conditional_logic": 0,
                    "wrapper": {
                        "width": "",
                        "class": "",
                        "id": ""
                    },
                    "default_value": "",
                    "placeholder": "",
                    "prepend": "",
                    "append": "",
                    "maxlength": "",
                    "readonly": 0,
                    "disabled": 0
                }
            ],
            "location": [
                [
                    {
                        "param": "post_type",
                        "operator": "==",
                        "value": "post"
                    }
                ]
            ],
            "menu_order": 0,
            "position": "normal",
            "style": "default",
            "label_placement": "top",
            "instruction_placement": "label",
            "hide_on_screen": "",
            "active": 1,
            "description": ""
        }
    ]
    
  • Thought I had it!

    Renamed the JSON file to ‘group_5746a271a9731.json’ to match the Field Group key.

    But still no luck. Verified Read/Write permissions for all on both the acf-json directory and the JSON file.

    Interestingly, note the suggested title for the Rule Group to sync DOES seem to have a group-key as part of the title, but it is different from any key in the JSON file, AND is different each time I reload the page.

  • the sync feature is meant for field groups that are automatically saved by ACF when the acf-json folder exists in the theme. There is a difference between the json files saved there and the json files that are created with the export. The files that are automatically saved contain a single field group while the export contains an array of field groups, even if there is only one group in the export. This is most likely why you can’t sync these groups or why it’s not working properly.

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

The topic ‘Problem syncing w. acf-json’ is closed to new replies.