Custom Post Type Rewrite 404 Errors
Written by Antti Koskenrouta on August 6, 2014
I was building yet another WordPress site and kept on getting 404s for my custom post type (CPT) links. It was very unusual, because it was a clean, new install with 2012 theme. To troubleshoot the issue, I ran down the list of usual suspects:
- Is ModRewrite enabled (Yes, because other pretty URLs worked)
- Was the CPT public and publicly queryable: Check
- Did the CPT rewrites work with just plain /%postname%/ – Ditto
I was trying to use custom taxonomy terms in my URLs with the help of the Custom Post Type Permalinks plugin, but I had used it numerous times without any problems in the past.
Turns out it had nothing to do with custom post type rewrites or the plugin
The arguments for the register_taxonomy function for my custom taxonomy had this line:
'rewrite' => false,
which kept the taxonomy terms in the URLs from being rewritten and, hence, working.
Just like with CSS: less is more, so it does make sense to check the Codex for default values of arguments for WordPress functions and not declare ones that you don’t need.