A custom post type’s registration code fires with zero errors, every diagnostic marker inside it logs successfully, and yet its menu item is still missing from the WordPress admin sidebar.
⚡ Quick Fix (TL;DR)
The Culprit: register_post_type() is commonly called on init, but WordPress builds the actual admin sidebar menu on a separate, later hook called admin_menu. A clean marker on init only proves the post type object itself registered – it says nothing about whether the later menu-building step actually succeeded. Trusting an init-only marker as proof the menu would appear cost a full round of false-negative testing before this was caught.
The Fix: When testing whether something admin-menu-related is actually working, add a diagnostic marker directly on admin_menu itself (a late priority like 999 ensures it runs after everything else on that hook) – test the specific hook that governs the real behavior in question, not just the nearest hook that happens to be convenient to log.
add_action( 'admin_menu', function() {
// confirms the menu-building step itself actually ran
zfn_debug_mark( 'admin_menu fired' );
}, 999 );Tagged in :
More from the field
Bisect to an Empty Baseline Before Trusting Any Single Theory
.
Multiple plausible-sounding theories for a bug each turned out to be wrong when actually tested – time was spent building fixes…
A Security Dashboard’s Activity Log Can Lag a Full Day Behind Real Time
.
Trying to check a security tool’s activity log for an event that had just happened showed nothing at all.