I have a few custom post types on my site:
- lydbok
- live
- bidragsyter
The post types are set up using this code.
The lydbok post type have been working good on it's on. But when I created the other custom post types I ran into a problem when creating the archive-{post-type}.php templates. It seems that WordPress is using archive-lydbok.php even though I've added the archive templates for the other post types as well.
I now have these archive-templates in my themes folder(all files with just the file name inside, no code):
- archive-lydbok.php
- archive-live.php
- archive-bidragsyter.php
- archive.php
But when I visit mysite.com/?post_type=live or mysite.com/?post_type=bidragsyter WordPress is showing the archive-lydbok.php template instead of their respective templates. If i delete archive-lydbok.php the same URLs are showing the archive.php file. Not their archive-{post-type}.php template.
I have tried updating the permalinks inside of WordPress admin, as well as deleting the .htaccess and flushing rewrites using flush_rewrite_rules(); — but I'm still experiencing the same result.
It's worth mentioning that I created the lydbok post type using Pods a few months earlier, but deleted the plugin to use PHP code instead. Not sure if that have anything to do with it? The Pods plugin is completly removed.