0

As stated in the title, I'm unable to get the archive or single pages of my custom post type to use the correct templates for them. Funny thing is, they worked just fine on my virtual server (WAMP), but upon moving to a test live server, the single-{custom-post-type} and archive-{custom-post-type} are refusing to load. The single and archive pages itself load just fine, but they are both reverting to index.php.

I have tried to flush the permalinks multiple times to no avail (admin->settings->permalinks->save), and even added flush_rewrite_rules() to my functions.php, run upon switching a theme (also tried).

I'm clueless as to what could be causing this. The files, hierarchy and content is exactly the same as I had on my virtual server, but obviously there is something on the new server that is keeping these template files from loading?

If anyone has ideas of what should I be looking at, please do share them. Unfortunately I'm not at liberty to share a link to my project...

  • Double check custom post type slug once. – bravokeyl Jul 1 '16 at 12:25
  • @slug is ok. However, there are capital letters and an underscore in my custom post type name. Could that be a problem? I came across another post which suggested something along those lines, but I would have to change that name in many places if I were to alter it... – JonK Jul 1 '16 at 12:40
  • What's your custom post type name and slug? – bravokeyl Jul 1 '16 at 12:41
  • Post the code so we can review? – jdm2112 Jul 1 '16 at 13:19
  • capital letters in post type slug can definitely break template loading. – Milo Jul 1 '16 at 15:33
0

Answering my own question here, for anyone who might encounter this problem in the future.

The cause for the right templates not loading was having uppercase letters in my template filename. Changing all characters in the filename to lowercase resolved the problem, and the templates are now being applied as they should.

I'm still unsure about what is the exact cause for this problem, especially as the uppercase filenames still worked on my local WAMP server, but were broken when moved to live server. I tried to do some Googling, and apparently it might have something to do with different PHP versions treating filenames differently or something along those lines. But like I said, I couldn't find anything conclusive.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.