Back to Community

Fixing Custom Post Type Permalink and 404 Issues in WordPress

36 threads Sep 16, 2025 PluginCustom post type ui

Content

Custom Post Type UI is a powerful tool for creating custom content types in WordPress. However, one of the most common areas where users encounter problems is with permalinks and URL structure. Issues range from 404 errors and unwanted URL prefixes to conflicts with other plugins. This guide will help you understand why these problems occur and how to resolve them.

Common Permalink Issues and Their Causes

Based on community reports, here are the most frequent permalink-related problems:

  • 404 Errors on Single Posts or Archives: This often happens after changing a post type's slug, enabling Multisite, or when a page exists with the same slug as your custom post type.
  • Unwanted /blog/ Prefix: CPT URLs suddenly include /blog/ in the structure (e.g., site.com/blog/cpt/post-name).
  • Incorrect Hierarchy or Slug Conflict: A post type's single post redirects to a post from a different post type, or media file URLs conflict with CPT URLs.
  • Custom Rewrite Rules Not Working: Attempts to create complex permalink structures or remove the post type slug entirely result in broken links.

How to Troubleshoot and Fix Permalink Issues

1. Always Flush Your Permalinks
The first and most crucial step for almost any permalink issue is to flush WordPress's rewrite rules. This regenerates the internal mapping of URLs to content. You can do this by visiting Settings > Permalinks in your WordPress admin and simply clicking "Save Changes" without making any modifications.

2. Check the 'With Front' Rewrite Setting
If your CPT URLs have a unexpected /blog/ prefix, the "With Front" setting is likely the culprit. This setting determines if the front of the permalink structure (like /blog/) should be prepended to your post type's permalink.

  • To remove the /blog/ prefix, edit your custom post type in CPT UI and set the "With Front" parameter to false.
  • To keep the prefix, ensure it is set to true.

3. Avoid Naming Conflicts
WordPress cannot have two different pieces of content with the same URL slug. A common cause of 404 errors is having a Page with the same slug as your custom post type or its archive. For example, if you have a page called "Locations" and a CPT also with the slug "locations," they will conflict. Rename either the page or the CPT slug to resolve this.

4. Understand the Limits of CPT UI
It's important to understand that the Custom Post Type UI plugin primarily handles the registration of post types and taxonomies. While it provides basic rewrite slug options, it cannot handle highly complex or nested permalink structures on its own (e.g., website.com/posttype1/category/country/city/posttitle). Achieving such structures requires custom code using WordPress's Rewrite API.

5. Investigate Plugin and Theme Conflicts
Sometimes, other plugins or your theme can interfere with rewrite rules. As seen in the threads, activating WooCommerce or a Multisite network can sometimes break previously working CPT URLs. A good troubleshooting step is to:

  1. Temporarily switch to a default WordPress theme (like Twenty Twenty-Four).
  2. Deactivate all other plugins except CPT UI.
  3. Check if the permalinks work correctly.
  4. If they do, reactivate your plugins one by one to identify the one causing the conflict.

6. Use Custom Code for Advanced Structures
For needs beyond CPT UI's settings, such as completely removing the post type slug from permalinks, you will need to add custom code to your theme's functions.php file. The provided code snippets in the community threads show that this involves two main filters:

  • post_type_link: To alter the generated permalink string.
  • pre_get_posts: To adjust the main query so WordPress can still find the post without its CPT slug in the URL.

Warning: Always use a child theme when adding custom code and test changes on a staging site first, as incorrect rewrite rules can break your site's navigation.

Conclusion

Most Custom Post Type UI permalink issues can be resolved by flushing rewrite rules and carefully reviewing the "With Front" and rewrite slug settings. For more complex problems, check for naming conflicts and plugin incompatibilities. Remember that highly custom URL structures will require development work beyond the plugin's interface. The WordPress community and Codex are excellent resources for finding and understanding the necessary code snippets for advanced customization.

Related Support Threads Support