Skip to content
  • Home
  • About
  • No Access
  • Privacy Policy
Bits of .NET
Bits of .NET
  • Asp.Net Core
  • C#
  • SQL
  • JavaScript
  • CSS
  • About
  • ErcanOPAK.com
  • No Access
  • Privacy Policy

Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

  • Asp.Net Core
  • C#
  • SQL
  • JavaScript
  • CSS
  • About
  • ErcanOPAK.com
  • No Access
  • Privacy Policy
Wordpress

WordPress: Fix a Custom Post Type That Disappears From the Admin Menu After an Update

- 27.09.26 - ErcanOPAK

📝 The Post Type That Was Still There, Just Not Visible to Anyone

A custom post type that vanishes from the WordPress admin menu after a plugin or theme update almost always still exists in the database, with all its content completely intact – what actually broke is the register_post_type() call itself, most commonly because the update changed the exact ‘slug’ string the post type is registered under, or introduced a silent PHP error partway through the registration code that stops it from completing successfully, and WordPress simply has no admin menu entry to show for a post type it no longer knows is supposed to be registered.

🔎 The Problem

// Before the update:
register_post_type('"'"'event_listing'"'"', [
    '"'"'label'"'"' => '"'"'Events'"'"',
    '"'"'public'"'"' => true,
    '"'"'show_in_menu'"'"' => true,
    '"'"'supports'"'"' => ['"'"'title'"'"', '"'"'editor'"'"', '"'"'thumbnail'"'"'],
]);

// After a theme/plugin update that renamed the internal slug as part
// of a broader refactor:
register_post_type('"'"'listing_event'"'"', [   // Different slug!
    '"'"'label'"'"' => '"'"'Events'"'"',
    '"'"'public'"'"' => true,
    '"'"'show_in_menu'"'"' => true,
    '"'"'supports'"'"' => ['"'"'title'"'"', '"'"'editor'"'"', '"'"'thumbnail'"'"'],
]);

// Every existing event post in the database still has post_type =
// '"'"'event_listing'"'"' - but WordPress now only recognizes and shows an
// admin menu for '"'"'listing_event'"'"', which has zero posts, since nothing
// migrated the existing content'"'"'s post_type value to match. The old
// posts still exist, completely intact, just no longer associated with
// any registered, visible post type.

✅ Fix: Confirm the Registered Slug First, Then Decide How to Reconcile It

  • Checking the wp_posts table directly (or via a quick WP_Query for any post type, filtered by the approximate date range the content was created) confirms whether the existing content’s actual post_type value in the database still matches what’s now being registered – this is the fastest way to tell a renamed-slug issue apart from a genuinely broken registration call.
  • A one-time migration (a simple SQL UPDATE, or a small WP-CLI script) that updates every existing post’s post_type column from the old slug to the new one reconciles historical content with the new registration, once the new slug is confirmed to be the intentional, permanent one going forward.
  • Enabling WP_DEBUG and WP_DEBUG_LOG temporarily and checking debug.log for a PHP error or warning around the theme/plugin’s functions.php is the direct way to catch the OTHER common cause – a fatal or caught-but-logged error partway through the file that stops register_post_type() from ever actually running at all, rather than a slug rename.

⚠️ Why the Content Being ‘Still There’ Is Easy to Miss

  • The admin menu simply not showing an entry gives no direct indication of WHY – it looks identical whether the post type registration silently failed due to a PHP error, or succeeded perfectly under a different slug than before, so the two genuinely different root causes require actually checking rather than being distinguishable from the symptom alone.
  • Panic that the content itself was deleted is a very natural first reaction to a post type disappearing from the admin menu entirely – checking the database directly, calmly, before assuming data loss, resolves this immediately in the far more common case where the content was never actually touched at all.

A missing admin menu entry means WordPress stopped recognizing a post type exists – it says nothing at all about whether the content filed under that post type is still sitting there, waiting to be reconnected.

— WordPress Admin

Related posts:

WordPress: Fix a Plugin Update That Silently Reverts Every Customized Setting Back to Its Default Va...

WordPress: Fix a Plugin Update That Silently Reverts Every Customized Setting Back to Its Default Va...

WordPress Admin Becomes Slower Over Time

WordPress Admin Becomes Slower Over Time

WordPress Pages Load Slowly Only for Logged-In Users

WordPress Pages Load Slowly Only for Logged-In Users

Views: 8

Post navigation

C#: Why a Sealed Override Still Gets Hidden by a Subclass Using the new Keyword
Ajax: Fix a Request Queue That Processes Responses Out of the Order They Were Sent

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

November 2026
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
30  
« Oct    

Most Viewed Posts

  • How to make theater mode the default for Youtube (1,068)
  • Get the User Name and Domain Name from an Email Address in SQL (990)
  • How to add default value for Entity Framework migrations for DateTime and Bool (986)
  • Get the First and Last Word from a String or Sentence in SQL (865)
  • How to select distinct rows in a datatable in C# (859)
  • How to enable, disable and check if Service Broker is enabled on a database in SQL Server (661)
  • Add Constraint to SQL Table to ensure email contains @ (619)
  • Average of all values in a column that are not zero in SQL (576)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (553)
  • Find numbers with more than two decimal places in SQL (481)

Recent Posts

  • Network Speed Monitor Windows Application v2.5.1
  • Ağ Hızı İzleyici Windows Uygulaması v2.5.1
  • How to make theater mode the default for Youtube
  • The AI Prompt That Audits a Function for Thread-Safety Gaps
  • Ajax: Fix a Fetch Request Caching a Response Despite No-Store
  • WordPress: Fix a Navigation Block Losing Submenu Items After Sync
  • Visual Studio: Fix CodeLens Reference Counts Stuck at Stale Numbers
  • C#: Fix a UTF-8 String Literal Behaving Differently in a Switch
  • Photoshop: Fix a Liquify Mesh Snapping Back on a Smart Object
  • The AI Prompt That Turns a Crash Dump Into a Short Repro Script

Most Viewed Posts

  • How to make theater mode the default for Youtube (1,068)
  • Get the User Name and Domain Name from an Email Address in SQL (990)
  • How to add default value for Entity Framework migrations for DateTime and Bool (986)
  • Get the First and Last Word from a String or Sentence in SQL (865)
  • How to select distinct rows in a datatable in C# (859)

Recent Posts

  • Network Speed Monitor Windows Application v2.5.1
  • Ağ Hızı İzleyici Windows Uygulaması v2.5.1
  • How to make theater mode the default for Youtube
  • The AI Prompt That Audits a Function for Thread-Safety Gaps
  • Ajax: Fix a Fetch Request Caching a Response Despite No-Store

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter
© 2026 Bits of .NET | Built with Xblog Plus free WordPress theme by wpthemespace.com