Skip to content

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

Description

@cbravobernal

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Type] BugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions