How to Use the ACF Clone Feature to Create Cleaner, Faster Flexible Layouts

How I rescued a WordPress site from 2-3 minute editor load times by splitting a massive ACF Flexible Content field into manageable, cloned field groups.

6 min read
1111 words
Featured image for "How to Use the ACF Clone Feature to Create Cleaner, Faster Flexible Layouts" - How I rescued a WordPress site from 2-3 minute editor load times by splitting a massive ACF Flexible Content field into manageable, cloned field groups.

ACF Flexible Field Rescue: A Performance Story 🚀

I want to share a story from a recent project that highlights a powerful, yet often overlooked, feature of Advanced Custom Fields (ACF): cloning fields. This isn't just a technical deep-dive; it's a real-world example of how a small architectural change can save a project from becoming an unmanageable beast.

The Challenge: A Beast of a Flexible Content Field

I was working with a client on a new version of their WordPress site. The original site was built with a single, massive ACF Flexible Content field that contained over 20 complex layouts. Each layout had its own set of sub-fields, repeaters, and conditional logic.

The editor experience was, to put it mildly, a nightmare.

Just opening a page in the WordPress admin would take 2-3 minutes for the editor to load. The browser would hang, the fans would spin up, and clients were understandably frustrated. They needed to add even more layouts for the new version of the site, and the existing setup was already at its breaking point.

I was facing a classic scalability problem. The initial architecture worked for a few layouts, but it couldn't handle the complexity the project had grown into.

The "Aha!" Moment: Splitting the Monolith

My first thought was to rebuild the whole thing in Payload or another modern CMS. But the client had a tight budget and timeline, and they were comfortable with the WordPress admin (when it worked). I needed a solution that would improve performance without a full rewrite.

That's when I remembered the ACF Clone feature.

Instead of having one giant Flexible Content field with 20+ layouts, what if I created a separate ACF Field Group for each layout?

Here's how the new architecture looked:

  1. Individual Field Groups: I created over 20 individual field groups, one for each layout. For example, Layout: Hero, Layout: Image Gallery, Layout: Testimonials. Each field group contained only the fields for that specific layout.
  2. The "Master" Flexible Content Field: I created a new, clean Flexible Content field. Instead of adding dozens of layouts with their own sub-fields, I added a single "Clone" field.
  3. Cloning the Layouts: Inside this "Master" field, I used the clone feature to bring in all the individual layout field groups.

The result was a "shell" Flexible Content field that dynamically pulled in the other field groups.

// Before: One massive flexible content field definition
'fields' => [
    [
        'key' => 'field_flexible_content',
        'name' => 'flexible_content',
        'type' => 'flexible_content',
        'layouts' => [
            'layout_hero' => [ /* ... dozens of fields ... */ ],
            'layout_gallery' => [ /* ... dozens of fields ... */ ],
            // ... 18 more complex layouts
        ],
    ],
],

// After: A lean flexible content field with cloned groups
'fields' => [
    [
        'key' => 'field_master_flexible_content',
        'name' => 'master_flexible_content',
        'type' => 'flexible_content',
        'layouts' => [
            'layout_clone' => [
                'key' => 'layout_clone',
                'name' => 'clone',
                'label' => 'Add Layout',
                'display' => 'row',
                'sub_fields' => [
                    [
                        'key' => 'field_cloned_layouts',
                        'name' => 'cloned_layouts',
                        'type' => 'clone',
                        'clone' => [
                            // ACF dynamically populates this with our "Layout: ..." field groups
                        ],
                    ],
                ],
            ],
        ],
    ],
],

The Results: A Future-Proofed, Performant Editor

The impact was immediate and dramatic:

  • Load Times Vanished: The page editor now loads instantly. No more 2-3 minute waits.
  • A Manageable Experience: Clients can now add and edit content without frustration. The admin interface is snappy and responsive.
  • Future-Proofed Architecture: Adding a new layout is as simple as creating a new field group. We don't have to touch the master Flexible Content field, reducing the risk of breaking existing content.
  • Improved Developer Workflow: I can now work on individual layouts in isolation. No more scrolling through a massive list of fields to find the one you need to edit.

This approach completely changed the trajectory of the project. I delivered a site that not only met the client's immediate needs but also gave them a scalable foundation for the future.

Automating the Split with AI and local-json

Manually splitting over 20 layouts was a tedious process. While effective, it involved a lot of clicking, copying, and pasting—time that could be better spent elsewhere. If I were to tackle this again, I'd use a more automated approach leveraging ACF's local-json feature and a little help from AI.

Here's the game plan:

  1. Enable JSON Sync: First, enable the ACF Local JSON feature. This saves your field group settings as .json files in your theme, allowing you to version control them with Git.

  2. Feed the Monolith to AI: Find the single, massive .json file that represents your flexible content field.

  3. Generate a Script: Use an AI assistant like Google's Gemini or Claude to write a PHP or Node.js script. The prompt would be something like this:

    "Here is an ACF JSON file for a flexible content field with many layouts. Write a script that iterates through each layout in this file and creates a new, separate ACF JSON file for each one. Each new file should be a valid ACF field group containing just one layout from the original."

The AI can parse the structure of the main JSON file and generate a script that programmatically creates the individual layout_xxxx.json files. You can then drop these new files into your acf-json directory, and ACF will automatically recognize them as new field groups.

This AI-assisted workflow transforms a multi-hour manual task into a few minutes of scripting, ensuring you don't miss a field or misconfigure a setting. It's a perfect example of using modern tools to streamline classic development challenges.

Why This Works So Well

ACF is incredibly powerful, but it's not magic. When you have a single field group with thousands of lines of configuration, WordPress has to parse all of that every time the editor loads. By splitting the layouts into their own field groups, we reduced the initial payload that the editor has to handle.

The clone feature then lets ACF intelligently load only the fields it needs, when it needs them.

The Bottom Line: Think Architecturally, Even in WordPress

This experience was a powerful reminder that architectural thinking isn't just for big, complex applications. Even in a "simple" WordPress build, taking the time to structure your fields and content types thoughtfully can make a huge difference.

If you're working on a WordPress site with complex ACF fields, and you're starting to feel the performance pain, take a look at the clone feature. It might just be the rescue your project needs.


Have you ever run into performance issues with ACF? How did you solve them? I'd love to hear your own war stories and solutions in the comments below.

Show Your Support

Like this post? Let me know!