WordPress Custom Post Type Single Template Not Working

I can’t think of the last WordPress site I did that didn’t use custom post types. They’re a feature I use all the time. As a result of using these custom post types, they often require a different layout to each other, and to the standard posts.

To do this you can use the built-in WordPress template heirarchy and name your template files in the format ‘single-customposttype.php’. Then, when viewing these custom post types, it should default to this template.

The Problem

A common problem I used to come across, and that I still see mentioned a lot today, is that when doing this it’s not using the single template that has been setup up for the post types. Instead it will default to the standard single.php.

The Solution

From what I can tell, this scenario arises particularly when the custom post type has been added after the permalink settings were last updated. What’s happening in the background, I’m not sure, but fortunately the solution is simple.

To get the custom post type’s single template working, you simple need to re-save the permalink settings in WordPress. Simply navigate to ‘Settings > Permalinks’ and click save.