Seamless clone fields after the first one are returned nested in a flexible content layout
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 86/100
Research direction
Read includes/fields/class-acf-field-clone.php around line 139, where acf_get_fields() expands seamless clone fields with array_splice(). Reproduce with a flexible content layout containing at least two seamless clone fields, then check get_fields() output. Done when each clone’s subfields are flat, matching the described ACF Pro 6.8.6 behavior.
Written by the indexing model from the issue text.
Description
SCF 6.9.8. In acf_get_fields() (includes/fields/class-acf-field-clone.php, around line 139), the
seamless clone filter takes the field count once, before the loop:
$count = count( $fields );
while ( $i < $count ) {
Inside the loop, array_splice() replaces each seamless clone with its sub fields, so $fields grows.
The loop stops at the old count, and the later seamless clones are never expanded.
Result: in a flexible content layout with several seamless clones, only the first one is flat.
The next ones come back nested under the clone field name. ACF Pro 6.8.6 returns all of them flat,
so a site that moves from ACF Pro to SCF gets different get_fields() output.
To reproduce: a flexible content field, one layout with 2 or more clone fields in "seamless" mode.
Save a post, call get_fields(): the second clone is an array under its name, not flat.
Fix: count again on each pass.
- $count = count( $fields );
- while ( $i < $count ) {
+ while ( $i < count( $fields ) ) {
With this change, get_fields() gives the same output as ACF Pro 6.8.6 for our 221 posts and the
options page.
- Dominant language
- PHP
- Stars
- 136
- Forks
- 73
- Avg merge
- 18h 21m
- Merged PRs (30d)
- 21
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from WordPress/secure-custom-fields
-
Port ACF's schema select2 dropdown JS so GEO pickers get the styled dropdownMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
WordPress/secure-custom-fields#507 ·
Maintainers usually reply within 1 day
-
JS: _acf-compatibility.js depends on sloppy-mode semantics (undeclared global, arguments aliasing)May be free again A pull request for this issue was closed without being merged. Open[Type] Code Quality
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
WordPress/secure-custom-fields#460 ·
Maintainers usually reply within 1 day
-
Blocks: undo and redo don't work for SCF block fields, and get stuck at SCF blocksMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 5/5 Over a week Newbie friendliness 35/100
WordPress/secure-custom-fields#577 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 1-2 days Newbie friendliness 52/100
WordPress/secure-custom-fields#576 ·
Maintainers usually reply within 1 day
-
Blocks V3 inline text editing: the caret jumps to the start of the field after the preview re-rendersMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 4/5 3-5 days Newbie friendliness 52/100
WordPress/secure-custom-fields#574 ·
Maintainers usually reply within 1 day
All issues in WordPress/secure-custom-fields
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
getgrav/grav-plugin-sitemap#125 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
nikic/PHP-Parser#1184 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
api-platform/core#8835 ·
Maintainers usually reply within 2 days
-
14.3.x
Difficulty 1/5 1-3 hours Newbie friendliness 82/100