0
votes

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.

1

1 Answers

0
votes

This has happened to me on several occasions, but mostly its solved by permalink update. Once i also had to rename a custom post type to make it work.

Try removing the lydbok post type code from your functions. And see if the rest of the post types follow the their corresponding archive page. If it works then you should rename your custom post type "lydbok" to something else.