release: v1.8.19 -- remove dead Settings API code from admin class - #68
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
docs/guides/CODE-QUALITY.mdflaggedincludes/admin/class-admin.phpas 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_*_sectioncall site, traced:admin_menu()(the only registered menu callbacks arerender_settings_app_page()forclicutcl-settings,logs_page()forclicutcl-logs,diagnostics_page()forclicutcl-diagnostics).get_unified_admin_settings()/save_unified_admin_settings()), which reads/writes options directly viaget_option()/update_option(), bypassing the Settings API entirely.class-admin.php(including JS/assets, forms posting tooptions.php) depends on it — grepped the whole repo, found nothing.Removed (confirmed unreachable)
register_settings()and itsadmin_inithook — 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 liveclicutcl-settingspage callback isrender_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().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 fromsave_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 withinsanitize_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 byget_unified_admin_settings()andsanitize_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 -1confirmed HEAD started atd62a184(v1.8.18 merge) before any changes.class-admin.php, and zero within it.useimports in the file still have body references (none became unused by the deletion).phpcs:disable/phpcs:enablepragma pairing in the file — the one pair present (WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound) is unaffected by the deletion and still balanced.options.phpwith the removed setting groups (clicutcl_gtm,clicutcl_server_side,clicutcl_attribution_settings), so droppingregister_setting()doesn't break any save path.includes/admin/traits/trait-admin-pages.phpand theadmin_menu()registration to confirm which pages are actually live before deleting anything.Known gap:
composer phpcscould not be run — no PHP runtime is available in this worker's sandbox (nophp/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
clicutcl.phpVersionheader +CLICUTCL_VERSION→1.8.19.changelog.txtandreadme.txtchangelog entries added, house style (file references inchangelog.txt, shorter user-facing summary inreadme.txt).readme.txtStable tagleft unchanged at1.8.13(3-version buffer policy).docs/guides/CODE-QUALITY.mdhotspot 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