WordPress / WordPress/secure-custom-fields
Site Health never counts PHP-registered field groups ('PHP' vs 'php' comparison); legacy site-health class is dead code
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 131
- Forks
- 64
- Avg merge
- 10m
- Merged PRs (30d)
- 1
Description
Description
- PHP-registered field group count is always 0. The Site Health data counts PHP field groups with
'PHP' === $field_group['local'], butacf_add_local_field_group()registers groups with'local' => 'php'(lowercase). The comparison never matches. The live class has this bug atsrc/Site_Health/Site_Health.php:520; the same comparison exists in the legacyincludes/class-acf-site-health.php:340. includes/class-acf-site-health.phpappears to be dead code. The plugin only instantiatesSCF\Site_Health\Site_Healthfromsrc/. The legacy class additionally treatsacf_get_post_types()/acf_get_taxonomies()(which return name strings) as arrays ($post_type['local']at:253-254), making its counts meaningless — further evidence it is unused and could be removed rather than fixed.
Reproduction
Repro test in #450: tests/php/includes/test-class-acf-site-health.php (php_field_groups asserted '0' with a PHP-registered group present, carrying the NOTE comment).
Suggested fix
Case-insensitive compare (or compare against 'php') in src/Site_Health/Site_Health.php; remove the legacy includes/class-acf-site-health.php after confirming nothing external instantiates it.
Found during the 2026-06 test campaign (see PR #450).
Contributor guide
No contributing guide indexed for this repository
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.
Research direction
Start with src/Site_Health/Site_Health.php:520 and the reproduction in tests/php/includes/test-class-acf-site-health.php, then compare the legacy implementation at includes/class-acf-site-health.php:340. Verify the PHP-registered field group count and confirm whether anything instantiates the legacy class. Done means the count is correct and the unused legacy code is removed if confirmed safe.
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
- 72/100