Roadmap item 17 (P2) — verified. Plugin-wide.
Problem
The plugin registers no activation, deactivation, or uninstall hooks at all. Three concrete consequences:
- Rewrite rules are never flushed. The
photo-of-the-week CPT registers a rewrite slug, but nothing flushes on activation — single Photo of the Week URLs 404 until an admin re-saves permalinks manually.
wp_template posts are never removed. Template\Template subclasses create wp_template posts on first load and tag them with the ucsc-2022 wp_theme term. Deactivating or deleting the plugin leaves orphaned template posts behind.
- Transients are never cleaned. The News block's taxonomy/term and media/coauthor transients survive deactivation, and there is no way to clear them short of a DB query. (There is currently no supported way for an editor to bust a stale editor dropdown.)
Fix
register_activation_hook → flush rewrite rules after CPT registration.
register_deactivation_hook → flush rewrite rules; delete plugin transients.
uninstall.php (or register_uninstall_hook) → remove generated wp_template posts, plugin options, and remaining transients.
- Consider a small admin action to purge News transients on demand — useful independent of uninstall, since stale editor dropdowns are a known support burden.
Everything must be guarded for the non-ACF and non-UCSC_NEWS_SITE cases, since neither the CPT nor the templates exist there.
Acceptance
Related: #109 — the ucsc-2022 coupling affects what "our templates" even means at uninstall time.
Roadmap item 17 (P2) — verified. Plugin-wide.
Problem
The plugin registers no activation, deactivation, or uninstall hooks at all. Three concrete consequences:
photo-of-the-weekCPT registers a rewrite slug, but nothing flushes on activation — single Photo of the Week URLs 404 until an admin re-saves permalinks manually.wp_templateposts are never removed.Template\Templatesubclasses createwp_templateposts on first load and tag them with theucsc-2022wp_themeterm. Deactivating or deleting the plugin leaves orphaned template posts behind.Fix
register_activation_hook→ flush rewrite rules after CPT registration.register_deactivation_hook→ flush rewrite rules; delete plugin transients.uninstall.php(orregister_uninstall_hook) → remove generatedwp_templateposts, plugin options, and remaining transients.Everything must be guarded for the non-ACF and non-
UCSC_NEWS_SITEcases, since neither the CPT nor the templates exist there.Acceptance
photo-of-the-weekpermalinks with no manual permalink re-savewp_templateposts and plugin optionsRelated: #109 — the
ucsc-2022coupling affects what "our templates" even means at uninstall time.