0

For some reason, my custom template WILL not show up in the backend of WordPress. I have tried the suggestions in this thread: Custom templates not showing up in template dropdown to no avail.

  • It has been more than 1 hour since I created the template.
  • I have removed transients from the database
  • I have checked on the server and the template is definitely there
  • The website is being routed through Clourdflare (I even put the site into development mode)
  • The server type is Litespeed

I have exhausted every bit of knowledge I have of these issues and the template still doesn't show up. It's driving me nuts. What should have been a simple development job has now turned into a 2 day epic attempt to just get my template to show up!

The server is on a live domain. One last option might be to download a copy to localhost but I didn't want to have to do that for a simple template creation.

Any ideas what I might do?

Thank you

EDIT: The code templates header is:

<?php /* Template Name: Downloads */ ?>
  • Can you provide the template's header, if not the whole template? That would main comment at the top of the template file. It's difficult to debug what might be happening without seeing some of the code. – phatskat Oct 19 '18 at 13:49
  • @phatskat please see edits above. It's basically just <?php /* Template Name: Downloads */ ?> at the moment – Ryan Mc Oct 19 '18 at 13:53
  • It would be better to put what's actually in your template file in your question. I expanded your snippet to gist.github.com/phatsk/5b50c1b91314ee8a3cae37b50ae951aa , named it template-downloads.php, it showed up in my templates list fine. The more code you can provide the better for diagnosing. – phatskat Oct 19 '18 at 13:56
  • There's nothing in the template, but even where there was something in the template I had the same problem. – Ryan Mc Oct 19 '18 at 14:01
  • And you named the file template-<something>.php in your theme folder? – phatskat Oct 19 '18 at 14:07
0

@jersh There is a bug in WP 4.9

Just fire this query to the database. then you will get template in selection drop down.

$wpdb->options => replace with your option table name.

DELETE FROM `$wpdb->options` WHERE `option_name` LIKE '_transient_files_%' LIMIT 1
|improve this answer|||||
  • Actually the problem turned out to be a client ho hadn't informed me that they had moved their website to new hosting - as it was routed through cloudflare it was harder to debug this – Ryan Mc Oct 26 '18 at 9:11
  • @RyanMc Alright if you want to do using plugin then here is [link] github.com/connorlacombe/WP-Clear-File-Cache – Prashant Suthar Oct 26 '18 at 9:14
  • I tried that and of course it didnt work because I was creating a template in the old server but the live website was being served from a new server. Thanks – Ryan Mc Oct 26 '18 at 9:18

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.