0

To give you a quick background on what I am working with - I manage 3 copies of our company website; our live site that customers visit, a dev site that is live but not indexed so that our website content team and I can test new things together, and a localhost site where I do all the code changes before I push them to our dev site. Every once in a while, when enough changes have been made and we are ready to make another big change, I refresh the dev site and my local site from our live site by exporting everything (database and all) and importing it on the others.

When I make a code change and am ready to deploy, I simply copy all the template files over to the destination site and overwrite all existing files.

The problem at hand, is that sometimes some of the pages will lose their association with the template file that was build for them and be changed to the default template when I overwrite the existing template files on a code publish. It's super inconsistent with when it happens and which pages it happens to, and I don't update any of the template names or file names, so it can't be that.

Does anyone have any thoughts or experience this with their sites?

1

It is impossible to guess how it breaks. Page template choice is stored in meta. Why would meta break? Who knows. Also who knows what else breaks that you might not be noticing.

The best advice to look into breakage would be to look into it right away when you hit the issue next. Look at the source site that works, look at the destination site. Compare the heck out of everything.

As a more general advice if you depend strongly on integrity of template assignment you may want to move away from managing it in interface. You can use page-$slug.php and page-$id.php paths of template hierarchy to hardcode those choice for example.

  • Didn't know about hardcoding the template choices... I will probably just do that and watch to see if it breaks again. Thank you! – jessrodier Sep 20 '17 at 18:12

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.