
You publish a post in a custom post type, click View, and the browser shows a 404 page instead of your content. When wordpress custom post type 404 error strikes, the post is sitting safely in the dashboard, the title and content are intact, and regular posts and pages still work fine. Only the custom post type returns nothing, which makes the fault feel strange and hard to pin down.
The cause is almost always the address system, not the content. WordPress matches each web address against a set of rewrite rules, and custom post types need their own rules to be built and kept up to date. If those rules are missing, stale, or clashing with something else, WordPress cannot match the address to the post, so it serves the 404 page. This guide works through the causes in order, from a one-minute permalink flush to a careful rebuild of the registration. Nothing here deletes your posts, and every fix can be tested on one post before you touch anything else.
Table of Contents
- Why This Error Happens
- Quick Checks
- Diagnosing the Problem
- Fix 1: Flush the Permalink Settings to Rebuild the Rewrite Rules
- Fix 2: Confirm the Post Is Published With the Correct Slug
- Fix 3: Check the Post Type Registers on Every Page Load
- Fix 4: Fix a Rewrite Slug Clash With Pages and Taxonomies
- Fix 5: Check the Archive Setting for the Post Type
- Fix 6: Deactivate Plugins to Find a Rewrite Conflict
- Fix 7: Switch to a Default Theme to Rule Out a Theme Fault
- Fix 8: Check the htaccess File and Server Rewrite Support
- Fix 9: Clear Every Cache and Test in a Private Window
- Fix 10: Correct the Registration Arguments for Public Visibility
- Fix 11: Rebuild the Registration in a Safe Place and Flush Again
- What to Avoid
- Frequently Asked Questions
- Conclusion
- Helpful Official Resources
Why This Error Happens
A custom post type is a content type beyond the built-in posts and pages, such as products, portfolio items, events, or listings. WordPress builds the web addresses for that type from rewrite rules stored in the database, and those rules are only rebuilt at certain moments, such as when the permalink settings are saved. Between those moments, anything that changes the registration, the slug, or the server setup can leave the stored rules out of step with reality. The six reasons below cover nearly every case.
1. The Rewrite Rules Were Never Rebuilt After Registration
WordPress stores rewrite rules in the database and reuses them for every visit, because rebuilding them on each page load would be slow. When a post type is registered for the first time, or when its rewrite slug changes, the stored rules do not update themselves. Until someone saves the permalink settings and forces a rebuild, the old rules keep running, and the new addresses match nothing. This is the single most common cause, and it explains why a post type works in the dashboard but returns 404 on the front end. A theme or plugin update can also change the registration just enough to need a fresh rebuild, even when nothing looks different in the settings.
2. The Post Type Only Registers Inside the Dashboard
Post types should be registered on every page load, through code that runs on the init hook for both the dashboard and the front end. If the registration code only runs in the admin area, perhaps because it sits inside a dashboard-only check or inside a file that only loads there, WordPress knows about the post type when you edit posts but forgets it when a visitor requests a page. The edit screen works, the post saves, and the front end still returns 404, because the front-end request never sees the registration. This fault often appears after a code move or a plugin update that changes when files load, and it is invisible in the dashboard itself.
3. A Slug Clash Is Behind the wordpress custom post type 404 error
Two pieces of content cannot own the same address. If a page uses the slug events and the post type also uses the rewrite slug events, WordPress must choose one owner for that address, and the loser returns 404. The same clash happens with a taxonomy slug, a category base, or even another post type using the same rewrite slug. Slug clashes are easy to create by accident, because the page and the post type are managed on different screens, and neither screen warns you about the other. The clash usually affects only one address pattern, which is why some posts work and others do not, and why the fault survives a permalink flush.
4. The Post Type Is Registered as Private or Not Queryable
Registration arguments decide who can see a post type. If public is false, or publicly_queryable is false, WordPress treats the posts as internal data and refuses to serve them on the front end, even when the rewrite rules are perfect. A query_var set to false has a similar effect, because WordPress cannot build the query that fetches the post. These settings are correct for internal data types that should never have public pages, but they are a fault when the type is meant to be readable. The posts still appear in the dashboard, and the editor still offers a View link, which makes the 404 feel like a bug rather than a setting.
5. A Plugin or Theme Overwrites the Rewrite Rules
Plugins that manage redirects, multilingual content, custom permalinks, or security rules can add, remove, or reorder rewrite rules. If such a plugin flushes the rules at the wrong time, or adds a broad rule that catches the post type addresses first, the post type rules never get a chance to match. Theme functions can do the same when they register their own post types or taxonomies with overlapping slugs. The fault often starts right after a plugin is installed, updated, or configured, and it can come and go as plugins flush the rules in different orders. Because the rules are shared, one plugin’s change can break a post type that the plugin never mentions.
6. The Server Never Passes Pretty Permalinks to WordPress
Pretty permalinks need the web server to hand every address to WordPress for matching. On Apache servers, that handoff depends on the .htaccess file and the mod_rewrite module. On Nginx servers, it depends on a rewrite block in the server configuration. If the file is missing, damaged, or read-only, or if the server block is absent, WordPress never sees the request, and the server itself returns the 404. This cause usually affects every pretty permalink on the site, not just the post type, but it is worth checking early when a new server, a migration, or a host change precedes the fault.
Quick Checks
Two minutes before the deep fixes.
- Open the post in the dashboard — is its status Published and its slug the one in the failing address?
- Switch the permalink setting to Plain, save, and test the post — does the plain address work?
- Open a regular post and a regular page — do they work while only the custom post type fails?
- Open the post type archive address — does the archive fail too, or only single posts?
- Think about when it started — did wordpress custom post type 404 error begin after an update, a migration, or a new plugin?
- Check whether a page, category, or taxonomy uses the same slug as the post type.
Diagnosing the Problem
| Symptom | Cause | Go to Fix |
|---|---|---|
| Single posts 404 but Plain permalinks work | Stale rewrite rules | Fix 1 |
| Post shows Draft or a different slug in the dashboard | Wrong status or slug | Fix 2 |
| Post type missing from front-end queries only | Registration runs in admin only | Fix 3 |
| One address pattern 404s while others work | Slug clash with a page or taxonomy | Fix 4 |
| Archive page 404s but single posts work | Archive setting disabled | Fix 5 |
| Fault started after a plugin install or update | Plugin rewrite conflict | Fix 6 |
| Fault started after a theme change or update | Theme registration fault | Fix 7 |
| Every pretty permalink on the site 404s | Server rewrite support missing | Fix 8 |
Fix 1: Flush the Permalink Settings to Rebuild the Rewrite Rules
Flushing the permalinks is the first fix because it solves the most cases in under a minute, with no code changes and no risk to content. Saving the permalink settings forces WordPress to rebuild the stored rewrite rules from the current registrations, which picks up any post type or slug change that happened since the last rebuild. Do this fix first, even if you are sure the registration is correct, because stale rules hide behind every other cause.

- Sign in to the WordPress dashboard as an administrator.
- Open Settings, then Permalinks.
- Read the current structure and note which option is selected.
- Click Save Changes without changing any setting.
- Open the failing post address in a new private browser window.
- Check whether the post now loads instead of the 404 page.
- If it loads, open two more posts of the same type to confirm the fix holds.
- Saving without changing anything is the whole trick. The save action rebuilds the rules, and the rules then include the post type addresses that were missing.
- If the post still returns 404, the rules are not the only problem, but the flush has still removed one suspect, and later fixes will build on clean rules. Do not flush repeatedly as a habit, because each flush is a rebuild, not a repair, and a fault that needs daily flushing has a deeper cause in the fixes below.
- When wordpress custom post type 404 error survives a flush, the next checks are the post itself and the registration. For broader address faults, our guide to permalink structure causing 404 errors covers the settings side in more depth.
Fix 2: Confirm the Post Is Published With the Correct Slug
Before blaming the rewrite system, confirm the post is actually available at the address you are testing. A draft, a scheduled post, a private post, or a post whose slug changed after sharing will all return 404 for visitors, even when the rewrite rules are perfect. This fix takes two minutes and prevents a long hunt for a fault that does not exist.
- Open the post in the dashboard and read its status at the top of the editor.
- If the status is Draft, Pending, or Scheduled, publish it or test with a published post.
- Click the post slug in the permalink shown above the title and read it carefully.
- Compare the slug character by character with the failing address in the browser.
- Fix any mismatch by editing the slug, then save the post.
- Open the corrected address in a private window and check the result.
- Check the Visibility setting — a Private post returns 404 for logged-out visitors.
- Slugs change silently more often than people expect. A title edit can regenerate the slug, a duplicate title can add a number to the end, and an import can assign slugs that differ from the old site.
- The dashboard permalink shown in the editor is the truth: if the address you tested differs from it by even one character, the test itself was wrong. Also check that the post belongs to the post type you think it does, because a post saved under the wrong type will never match the type address pattern.
- When the status, slug, and visibility are all correct and the 404 remains, the fault is in the rules or the registration, not the post.
Fix 3: Check the Post Type Registers on Every Page Load
A post type must be registered on every request, front end and dashboard alike. Registration that only runs in the dashboard creates the classic symptom: everything works while editing, and everything fails for visitors. This fix checks where and when the registration runs, without changing any code yet.
- Find where the post type is registered — a plugin, the theme functions file, or a code-snippets plugin.
- Open the registration code and look for the hook it uses — it should be
init. - Check for any condition around the registration, such as a check that only runs in the admin area.
- Look for the registration inside a file that only loads in the dashboard.
- If the post type comes from a plugin, check the plugin is active and has no error notice.
- If the post type comes from the theme, confirm the theme that registers it is the active theme.
- Test the front end again after any timing fix, and flush the permalinks once more.
- The
inithook runs on every WordPress load, which is why registration belongs there. Code hooked to an admin-only action, or wrapped in a condition that checks for the dashboard, will never run for a visitor request. - The same applies to code in a file that the theme only includes on admin pages. If you cannot read the code yourself, ask the plugin or theme author where the registration runs, or test by switching the registration to a code-snippets plugin set to run everywhere, as Fix 11 describes.
- A registration that runs everywhere, followed by one permalink flush, ends this cause for good.
Fix 4: Fix a Rewrite Slug Clash With Pages and Taxonomies
When two pieces of content claim the same address, one of them loses. The rewrite slug of the post type must be unique across pages, taxonomies, categories, and other post types. This fix finds the clash and gives each owner a distinct address, which is the only lasting solution — no amount of flushing will make two owners share one address.

- Note the rewrite slug of the post type from its registration or plugin settings.
- Search Pages in the dashboard for a page with the same slug.
- Search the taxonomies of the post type for a term or base using the same slug.
- Check other post types and the category and tag bases for the same slug.
- Rename the weaker claim — usually the page slug or the taxonomy slug — to something distinct.
- Save the permalink settings once to rebuild the rules after the rename.
- Test both addresses: the post type address and the renamed page address.
- Deciding which owner keeps the slug is a judgement call. The post type usually keeps it when the archive matters, and the page takes a new slug, with a redirect from the old page address if it was shared or indexed.
- Never leave both claims in place and hope the flush sorts it out, because the rewrite matcher picks one rule and the other address will keep failing. After the rename, update any menus or links that pointed at the renamed page, and check the archive address separately from single posts, since the archive uses its own rule.
- Our guide to general WordPress 404 error fixes covers address faults that affect the whole site, if the clash turns out to be wider than one slug.
Fix 5: Check the Archive Setting for the Post Type
Single posts and archive pages use different rewrite rules, so one can work while the other fails. If single posts load but the archive address returns 404, the archive setting is the suspect. The has_archive argument controls whether WordPress builds an archive rule at all, and a false value means the archive address matches nothing by design.
- Open the failing archive address and confirm it returns 404.
- Open a single post of the same type and confirm it loads.
- Find the
has_archivevalue in the registration code or plugin settings. - If it is false and you need an archive page, set it to true or to the archive slug you want.
- If it is a text slug, confirm that slug matches the address you are testing.
- Save the permalink settings once to rebuild the rules.
- Open the archive address again in a private window and check the result.
- An archive slug that differs from the rewrite slug is a common trap. The registration can set
has_archiveto a custom string, which makes the archive live at a different address from the one you expect, while the expected address returns 404. - Read the actual value instead of guessing, and test the address the value implies. If the post type is meant to have no archive, the 404 on the archive address is correct behaviour, and the fix is to stop linking to it, not to force an archive into existence.
- When the archive and single posts disagree, the settings for each must be checked separately, because fixing one rule never fixes the other.
Fix 6: Deactivate Plugins to Find a Rewrite Conflict
Plugins share the rewrite system, so one plugin’s rules can break another plugin’s post type. The clean way to find the culprit is to deactivate all plugins, test the post type, and then reactivate plugins one at a time. This fix is safe on a live site if you work quickly and reactivate as you go, but a staging copy is better when the site takes real orders or bookings.
- Take a backup of the site, or confirm a recent backup exists.
- Open Plugins, then Installed Plugins, in the dashboard.
- Deactivate every plugin except the one that registers the post type, if it is plugin-based.
- Flush the permalink settings once with the other plugins off.
- Test the failing post address in a private window.
- If the post loads, reactivate plugins one at a time, testing the address after each one.
- When the 404 returns, the last reactivated plugin is the culprit — keep it off and check its settings.
- Test after each reactivation, not in batches, because batch testing hides which plugin caused the return. Pay special attention to redirect plugins, multilingual plugins, custom permalink plugins, and security plugins, since all four touch rewrite rules or request handling.
- If the culprit plugin is essential, look for a setting that controls its rewrite behaviour, check for an update, or ask its author about the clash before giving up on it. A plugin that breaks the post type only when its own rules flush at the wrong time may need its settings changed rather than removal.
- For the wider method, our guide to plugin conflict checks walks through the same process for faults beyond rewrite rules.
Fix 7: Switch to a Default Theme to Rule Out a Theme Fault
Themes can register post types, taxonomies, and rewrite rules of their own, and a theme fault can hide a post type that a plugin registers. Switching to a default WordPress theme for a short test shows whether the theme is involved. If the post type is registered by the theme itself, it will vanish from the dashboard under the default theme, which is itself useful information.

- Note the current theme name and take a backup if you have not already.
- Open Appearance, then Themes, in the dashboard.
- Activate a default theme, such as Twenty Twenty-Five.
- Flush the permalink settings once under the default theme.
- Test the failing post address in a private window.
- Check whether the post type still appears in the dashboard menu.
- Switch back to the original theme, then flush the permalinks once more.
- Read the result carefully. If the post loads under the default theme, the original theme is interfering, and its functions file or its own registrations need review.
- If the post type vanishes from the dashboard under the default theme, the theme was registering it, and the registration will need a safer home, as Fix 11 describes. If nothing changes, the theme is innocent, and you have ruled it out cleanly.
- Do not leave the default theme active on a live site longer than the test needs, because the design will change for visitors. A staging copy removes that worry entirely, and it is the right place for longer theme testing.
Fix 8: Check the htaccess File and Server Rewrite Support
When pretty permalinks fail everywhere, the server is not handing requests to WordPress. On Apache hosting, the .htaccess file in the site root carries the rewrite block, and a missing or damaged file breaks every pretty address. On Nginx hosting, the rewrite rules live in the server configuration, which only the host can usually edit. This fix checks the Apache case directly and tells you what to ask the host in the Nginx case.
- Confirm the fault affects regular posts and pages too, not just the post type.
- Switch permalinks to Plain, save, and test — if Plain works, the server handoff is the fault.
- Switch back to your usual permalink structure and save.
- Using hosting file access or FTP, open the
.htaccessfile in the site root. - Confirm it contains the standard WordPress rewrite block between the WordPress markers.
- If the file is missing or the block is damaged, ask the host to restore it, or rebuild it by saving permalinks again.
- On Nginx hosting, ask the host to confirm the WordPress rewrite block is present in the server configuration.
- Never paste rewrite rules copied from a random forum post into the file without understanding them, because a wrong block can take the whole site down. The standard WordPress block is short and well known, and saving the permalink settings regenerates it when the file is writable.
- If the file is read-only, WordPress will say so on the permalink screen, and the host must fix the permissions. When the server handoff is restored, flush the permalinks once more and test the post type address.
- A server fault fixed here also fixes every other pretty permalink on the site at the same time.
Fix 9: Clear Every Cache and Test in a Private Window
Caches can serve an old 404 page long after the real fault is fixed, which makes a working site look broken. Page caches, object caches, content delivery network caches, and the browser cache can each hold the stale error. This fix clears each layer in turn and tests in a way that bypasses them, so you can trust the result you see.
- Open the failing address in a private browser window and note the result.
- Clear the cache in the caching plugin, if one is installed, using its purge option.
- Clear the cache in the hosting control panel, if the host provides one.
- Purge the content delivery network cache, if the site uses one.
- Clear the browser cache, or test in a different browser you rarely use.
- Test the post address again in a private window after each layer is cleared.
- If the post loads only after a purge, the fault was stale cache, and the earlier fixes already worked.
- Test in a private window throughout this guide, not just in this fix, because a signed-in browser can show different results from what visitors see. Logged-in administrators often bypass the page cache, which is why a post can load for you and 404 for everyone else.
- The same applies to the object cache, which can hold stale rewrite rules after a flush — a hosting cache purge or a brief plugin deactivation clears it. When wordpress custom post type 404 error appears only for visitors and never for the administrator, caching is the first suspect, not the last.
Fix 10: Correct the Registration Arguments for Public Visibility
If the rules are fresh, the slugs are unique, and no plugin or theme is interfering, the registration arguments themselves are the remaining suspect. The arguments that control visibility must all agree that the post type is public and queryable. This fix lists the values to check and what each one must be for a public post type.

- Open the registration code or the plugin settings for the post type.
- Confirm
publicis true for a post type meant to be readable. - Confirm
publicly_queryableis true, or left unset so it follows the public value. - Confirm
query_varis true or a text string, and never false. - Confirm
rewriteis true or an array with the intended slug, and never false. - Confirm
show_in_restis true if the block editor or the REST API must see the type. - Save the change, flush the permalink settings once, and test a single post and the archive.
- One wrong value is enough to hide the whole type, so check each argument even when the others look right. A
query_varof false is a quiet fault: the rewrite rules build normally, the dashboard works, and every front-end request still fails because WordPress cannot form the query. - The same applies to a
rewritevalue of false, which builds no rules at all. If the registration comes from a plugin with a settings screen, use the screen rather than editing code, because the screen keeps the arguments consistent. - Visibility faults can also affect the REST API, so if API requests fail too, our guide to REST API 404 errors covers that side of the same settings.
Fix 11: Rebuild the Registration in a Safe Place and Flush Again
When the registration is scattered, duplicated, or tied to a theme that may change, the lasting fix is to rebuild it in one safe place that runs on every load and survives theme changes. A small custom plugin or a code-snippets plugin set to run everywhere is the right home. This fix moves the registration once, carefully, and then verifies the result before anything else changes.
- Take a full backup of the site, including the database.
- Copy the current registration code into a text file so the original settings are preserved.
- Create the registration in a code-snippets plugin set to run on the front end, or in a small custom plugin.
- Remove or disable the old registration so the post type is registered exactly once.
- Confirm the code hooks to
initand uses the visibility values from Fix 10. - Flush the permalink settings once and test a single post, the archive, and the dashboard list.
- Keep the backup until a full day of normal use confirms the post type is stable.
- Registering the same post type twice, with different arguments in two places, creates faults that appear and disappear depending on which registration runs last. That is why the old registration must be removed, not merely left in place alongside the new one.
- A theme functions file is a poor home for a post type the site depends on, because switching themes would unregister the type and hide every post of that type from the front end. The safe home keeps the type alive through theme changes, updates, and plugin shuffles.
- After the rebuild, resist the urge to change slugs or settings for a while, and let one stable configuration prove itself across real visits.
What to Avoid
- Do not edit rewrite rules or server files from a random forum post — a wrong block can take the whole site down.
- Do not flush the permalinks every day as a routine — a fault that needs daily flushing has a deeper cause.
- Do not register the same post type in two places — duplicate registrations with different settings create faults that come and go.
- Do not use a page slug that matches the post type rewrite slug — only one owner can hold an address.
- Do not use pirated software, activators, or cracks — nulled plugins and themes can damage registrations and invite malware.
- Do not delete posts or the post type to “start fresh” before taking a backup — deleted content is hard to restore.
- Do not test only while signed in as an administrator — visitors can see a different result because of caching and permissions.
Frequently Asked Questions
Why do regular posts work but custom post type posts return 404?
Because regular posts use rewrite rules that WordPress builds by default, while custom post types need their own rules built from the registration. If the rules are stale, the slug clashes, or the registration only runs in the dashboard, the custom type fails while built-in types keep working. Flush the permalinks first, then check the slug and the registration as Fixes 1, 3, and 4 describe.
Does flushing the permalinks delete any content or settings?
No. Saving the permalink settings only rebuilds the stored rewrite rules from the current registrations. It does not delete posts, pages, media, or settings, and it does not change the permalink structure you selected. It is safe to run on a live site, and it is the first fix precisely because it carries no risk to content.
Why does the 404 return after I flush the permalinks?
Because something rebuilds or overwrites the rules after your flush, or because the registration itself changes between loads. A plugin that flushes rules at the wrong time, a duplicate registration, or a theme that registers the type only sometimes can all undo a flush. Work through Fixes 6, 7, and 11 to find the moving part, and keep the registration in one safe place.
Can a slug clash really cause a 404 for a whole post type?
Yes, when the clash is on the rewrite slug or the archive slug that every post of the type shares. A page with the same slug captures the address pattern, and the post type addresses never match. Single posts can still work through other patterns while the archive fails, or the reverse, depending on which rule wins. Rename one claim, as Fix 4 describes, and the pattern clears.
Should the post type be registered in the theme or in a plugin?
In a plugin, or in a code-snippets plugin set to run everywhere. A theme registration disappears when the theme changes, which hides every post of that type from the front end. A plugin registration survives theme changes and keeps the content reachable. If the theme currently registers the type, move the registration as Fix 11 describes, and keep a backup until the new setup proves stable.
What if Plain permalinks work but pretty permalinks fail for everything?
Then the server is not handing pretty addresses to WordPress, and the post type is not the real fault. Check the .htaccess file on Apache hosting, or ask the host to confirm the rewrite block on Nginx hosting, as Fix 8 describes. Once the server handoff works, flush the permalinks once and test the post type address again.
Conclusion
When wordpress custom post type 404 error hides posts that clearly exist, the answer is almost always in the address system: stale rewrite rules, a slug clash, a registration that runs in the wrong place, or a visibility setting that hides the type. Flush the permalinks first, then confirm the post, the slug, and the registration in order, and finish by clearing the caches so the result you see is the real one. Test a single post, the archive, and the dashboard list before calling the fault fixed, because each uses its own rule. Keep the registration in one safe place that runs on every load, and the post type will stay reachable through updates and theme changes alike.
