WordPress / WordPress/secure-custom-fields

acf_remove_local_field_group() leaves the group's fields registered (orphans in local-fields store)

Open
#458 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

[Type] Bug
Dominant language
PHP
Stars
131
Forks
64
Avg merge
10m
Merged PRs (30d)
1

Description

Description

acf_remove_local_field_group() (includes/local-fields.php:283) removes only the group from the local-groups store; the fields registered under it remain in the local-fields store as orphans — still discoverable by key/name lookups after their group is gone.

Reproduction

Repro test in #450: tests/php/includes/test-local-fields.php::test_remove_local_field_group_leaves_fields_registered.

Suggested fix

Cascade removal of child fields (recursively, covering sub-fields) when the group is removed — or document the asymmetry if it is intentional.

Found during the 2026-06 test campaign (see PR #450).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in includes/local-fields.php:283 and read the reproduction in tests/php/includes/test-local-fields.php::test_remove_local_field_group_leaves_fields_registered. Determine whether removing a group should recursively remove its child and sub-fields or document the asymmetry. Done when the orphan lookup behavior is resolved and the reproduction test reflects the intended result.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.