WordPress / WordPress/secure-custom-fields

Site Health never counts PHP-registered field groups ('PHP' vs 'php' comparison); legacy site-health class is dead code

Open
#456 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

  1. PHP-registered field group count is always 0. The Site Health data counts PHP field groups with 'PHP' === $field_group['local'], but acf_add_local_field_group() registers groups with 'local' => 'php' (lowercase). The comparison never matches. The live class has this bug at src/Site_Health/Site_Health.php:520; the same comparison exists in the legacy includes/class-acf-site-health.php:340.
  2. includes/class-acf-site-health.php appears to be dead code. The plugin only instantiates SCF\Site_Health\Site_Health from src/. The legacy class additionally treats acf_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

  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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.