Get the Official WPSaviour App Now!


How to Fix Custom Post Type 404 Errors In WordPress

With the discharge of WordPress got here the flexibility so as to add “Customized Put up Varieties” to your WordPress themes which is a really helpful software and I’ve utilized in in lots of WordPress themes I’ve created. By now Customized Put up varieties have develop into extraordinarily in style and utilized in nearly each WordPress theme on the market. However anybody whom has labored with customized put up varieties has most likely encountered the dreadful 404 Not Discovered Error when attempting to entry a put up from the put up kind at one level or one other. Fortunately there’s nearly at all times a easy repair to fixing these errors.

Under I’ve listed among the extra frequent points individuals have with Customized Put up Varieties and why they might be receiving these errors. Hopefully they may assist not less than just a few individuals on the market.

1. Verify Your Permalink Settings

That is most likely some of the frequent causes individuals are getting 404 errors on their customized put up varieties and I’ve handled it many instances. I’ve seen many fixes on the market similar to flushing the rewrite guidelines (which I don’t advocate) however personally I’ve had finest luck with the next merely repair:


  • Set your customized permalink construction (similar to %postname%)
  • Click on Save
  • See in case your single customized put up pages return 404 error pages
  • In the event that they do, return and alter permalinks again to default and save
  • Now strive setting the customized permalink once more and save

Going backwards and forwards has usually helped repair my errors and I’ve had a variety of success with this methodology.

Now, on some servers in case your permissions aren’t set appropriately this will not work and you might have to replace your .htaccess file manually. To do that you’ll have to log into your website through FTP or SFTP and browser to your root WordPress listing (similar place the place your wp-config.php file and wp-content folder is situated). Right here it is best to discover a file named .htaccess which you’ll be able to modify (in case you don’t see it make sure that your FTP program has the choice to show hidden information enabled and if there merely isn’t one then create one). Now make sure that the file accommodates the core WordPress code as talked about within the WordPress docs, which appears to be like like this:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

Necessary: If you’re modifying an present .htaccess file make sure that to again up the file in your laptop first simply incase you mess something up.

2. Verify for slug conflicts (having a web page with the identical slug as your put up kind)

One other factor that will trigger a 404 error is that you’ve a principal web page to show your put up kind put up and it has the identical slug as your precise put up kind singular slug. For instance in case you have a put up kind named “portfolio” and also you even have a principal “Portfolio” web page each with the slug “portfolio” (in different phrases to entry a portfolio put up you’d go to this creates a battle inflicting 404 errors in your singular put up kind posts. That’s why you usually discover that the portfolio put up kind makes use of the slug “initiatives” or “portfolio-item” for the singular slug.


  1. You’ll be able to change the web page identify so it’s completely different then the customized put up kind
  2. You’ll be able to change your customized put up kind slug which is completed by altering the rewrite parameter when registering your customized put up kind

3. Auto Flush Rewrite Guidelines (for builders)

One other reason behind 404 errors is every time a brand new put up kind is registered it’s a must to “flush” your rewrite guidelines in WordPress. This may be carried out by going to Settings > Permalinks and clicking the save button (talked about within the first part of this put up).

If you’re engaged on a customized theme or plugin with registered put up varieties you might need to contemplate robotically flushing the rewrite guidelines on your finish person after they activate your theme or plugin to forestall any 404 errors. Under is an instance of the code you should use:

// Code for themes
add_action( 'after_switch_theme', 'flush_rewrite_rules' );

// Code for plugins
register_deactivation_hook( __FILE__, 'flush_rewrite_rules' );
register_activation_hook( __FILE__, 'myplugin_flush_rewrites' );
perform myplugin_flush_rewrites() {
	// name your CPT registration perform right here (it also needs to be hooked into 'init')

Download The WPSaviour App Now

Related posts
Beginner’s GuideBlogSEO

WordPress Pre-Launch SEO Checklist: 7 Tips to Improve Rankings


SEO Optimization For WordPress Slugs


Increase Traffic to Your WordPress Site in 6 Easy Steps


How To Automatically Nofollow External Links In WordPress

Sign up for our Newsletter and
stay informed

Fear Of Missing Out?

Sign up with your email address to receive WordPress tips and updates
Terms and Conditions apply
Click Me