Skip to content

release: v1.8.19 -- remove dead Settings API code from admin class - #68

Merged
Atroci merged 1 commit into
mainfrom
agent-v1-8-19-admin-cleanup
Aug 16, 2026
Merged

release: v1.8.19 -- remove dead Settings API code from admin class#68
Atroci merged 1 commit into
mainfrom
agent-v1-8-19-admin-cleanup

Conversation

@Atroci

@Atroci Atroci commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Summary

docs/guides/CODE-QUALITY.md flagged includes/admin/class-admin.php as a maintenance hotspot: the active admin UX runs through the unified settings app, but the file still carried older Settings API registrations and callback helpers alongside the live screen bootstrap. This removes what's confirmed unreachable.

Line-count delta: includes/admin/class-admin.php: 2276 → 1383 lines (−893).

Method to confirm dead code

For every register_setting/add_settings_field/add_settings_section/render_*_field/render_*_section call site, traced:

  1. Whether it's reachable from admin_menu() (the only registered menu callbacks are render_settings_app_page() for clicutcl-settings, logs_page() for clicutcl-logs, diagnostics_page() for clicutcl-diagnostics).
  2. Whether it's referenced by the unified settings app's save/load path (get_unified_admin_settings() / save_unified_admin_settings()), which reads/writes options directly via get_option()/update_option(), bypassing the Settings API entirely.
  3. Whether anything outside class-admin.php (including JS/assets, forms posting to options.php) depends on it — grepped the whole repo, found nothing.

Removed (confirmed unreachable)

  • register_settings() and its admin_init hook — registered Settings API groups (clicutcl_attribution_settings, clicutcl_gtm, clicutcl_server_side) that nothing renders anymore.
  • render_settings_page() — never registered as any menu page's callback (the live clicutcl-settings page callback is render_settings_app_page(), a different, still-live method). Removed along with everything only reachable from it: get_settings_tabs(), get_settings_form_config(), get_settings_cards(), render_settings_status_bar(), render_status_pill(), render_settings_card(), render_settings_save_bar().
  • Settings-API field renderer callbacks, whose only callers were inside the now-removed register_settings(): render_text_field(), render_select_field(), render_checkbox_field(), render_number_field(), render_gtm_text_field().

Flagged but kept (not confident enough to remove) — none

Tracing turned up no ambiguous cases. Everything else the file exposes as sanitize_*/schema helpers is genuinely live:

  • sanitize_settings(), sanitize_server_side_settings() — called directly from save_unified_admin_settings() (the live save path) and from the diagnostics import/export AJAX handlers (trait-admin-diagnostics-ajax.php, trait-admin-pages.php).
  • normalize_settings_input(), sanitize_toggle(), sanitize_cookie_days(), sanitize_observer_target(), sanitize_domains_csv() — called from within sanitize_settings()/get_attribution_settings_schema(), i.e. still on the live save path even though they were originally built to also serve the dead Settings API.
  • get_attribution_settings_schema(), get_attribution_settings_defaults() — used by get_unified_admin_settings() and sanitize_settings().

These happened to be reachable from both the dead Settings-API tree and the live unified-app path; kept because the live callers remain after the dead callers are removed.

Verification

  • git log -1 confirmed HEAD started at d62a184 (v1.8.18 merge) before any changes.
  • Repo-wide grep confirmed zero remaining references to every removed method name outside class-admin.php, and zero within it.
  • Brace/paren balance check across the edited file, plus manual read of both removal seams to confirm no stray fragments.
  • Checked all 7 use imports in the file still have body references (none became unused by the deletion).
  • Checked phpcs:disable/phpcs:enable pragma pairing in the file — the one pair present (WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound) is unaffected by the deletion and still balanced.
  • Confirmed no JS/asset code posts to options.php with the removed setting groups (clicutcl_gtm, clicutcl_server_side, clicutcl_attribution_settings), so dropping register_setting() doesn't break any save path.
  • Re-read includes/admin/traits/trait-admin-pages.php and the admin_menu() registration to confirm which pages are actually live before deleting anything.

Known gap: composer phpcs could not be run — no PHP runtime is available in this worker's sandbox (no php/composer/Docker). Manual verification above (call-graph tracing, brace/paren balance, seam review, import/pragma checks) was done in its place, but this should be treated as unverified by static analysis until CI runs it.

Other changes

  • Version bump: clicutcl.php Version header + CLICUTCL_VERSION1.8.19.
  • changelog.txt and readme.txt changelog entries added, house style (file references in changelog.txt, shorter user-facing summary in readme.txt).
  • readme.txt Stable tag left unchanged at 1.8.13 (3-version buffer policy).
  • docs/guides/CODE-QUALITY.md hotspot Align ClickTrail integrations and settings defaults #1 marked resolved, following the same pattern as hotspot Add readme and license metadata #2.

No functional or user-facing changes; the settings screens (General/Server-side/Logs/Diagnostics) render exactly as before.

🤖 Generated with Claude Code

Removed register_settings() and its admin_init hook, render_settings_page()
and everything only reachable from it, and the unused Settings-API field
renderer callbacks in includes/admin/class-admin.php (2276 -> 1383 lines).
Traced every register_setting/add_settings_field/add_settings_section/
render_*_field call site against the live admin menu and the unified
settings app's save/load path before removing; nothing removed had a live
caller. Kept the sanitize_* helpers and settings schema/defaults, which back
the live unified-settings save path independent of the removed scaffolding.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Atroci
Atroci merged commit 7dd7bce into main Aug 16, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant