Skip to content

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 Scheduled Posts Miss Publish Time

Disable Emojis Without Plugins

WordPress REST API Returns 401 Only in Production

Post Views: 3

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 *

October 2026
M T W T F S S
 1234
567891011
12131415161718
19202122232425
262728293031  
« Sep    

Most Viewed Posts

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

Recent Posts

  • CSS: Fix a prefers-color-scheme Media Query That Gets Silently Overridden by a Browser Extension’s Forced Dark Mode
  • Git: Fix a Merge Commit That Silently Drops a File Because Both Branches Deleted It Differently
  • HTML5: Fix a Native Lazy-Loading Image That Never Loads Because It Sits Inside a Hidden Tab Until the User Clicks It
  • The AI Prompt That Traces a Null Reference Exception Back to the Exact Line That First Produced the Null
  • The AI Prompt That Turns a Gym Membership Contract’s Fine Print Into a Plain-English List of Cancellation Steps
  • Photoshop: Fix a Color Profile Mismatch That Makes Printed Output Look Nothing Like What You Saw On Screen
  • WordPress: Fix Search Results That Return Pages From a Theme You Deactivated Months Ago
  • Visual Studio: Fix a Test Project That Builds Fine Alone but Fails to Discover Any Tests After a NuGet Restore
  • ASP.NET Core: Fix a File Upload That Times Out on Slow Connections Only Because Kestrel’s Minimum Data Rate Feature Kicked In
  • JavaScript: Fix an Array Destructuring Default Value That Silently Never Applies Because null Was Passed Instead of Undefined

Most Viewed Posts

  • Get the User Name and Domain Name from an Email Address in SQL (973)
  • How to make theater mode the default for Youtube (950)
  • How to add default value for Entity Framework migrations for DateTime and Bool (939)
  • Get the First and Last Word from a String or Sentence in SQL (847)
  • How to select distinct rows in a datatable in C# (836)

Recent Posts

  • CSS: Fix a prefers-color-scheme Media Query That Gets Silently Overridden by a Browser Extension’s Forced Dark Mode
  • Git: Fix a Merge Commit That Silently Drops a File Because Both Branches Deleted It Differently
  • HTML5: Fix a Native Lazy-Loading Image That Never Loads Because It Sits Inside a Hidden Tab Until the User Clicks It
  • The AI Prompt That Traces a Null Reference Exception Back to the Exact Line That First Produced the Null
  • The AI Prompt That Turns a Gym Membership Contract’s Fine Print Into a Plain-English List of Cancellation Steps

Social

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