Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

WP DB issue, Wordpress Page templates not loading after CPT post import. WordPress

  • SOLVED

Hi everyone

I hope someone here can help me, i'm having a wierd issue with my WP installation on a project i'm working on,

For some context, i'm working on a project where i have a local copy and i have a "live" copy on an external server, both are under version control, when i update my local copy and push it up to my repo, the live copy does an automatic pull to reflect the repo,

I'm having a really strange problem, recently opened my local copy and found that all my custom page template pages (page template: example page template) for example, for for some reason not loading and the site was automatically redirecting the user to the base index.php in my theme folder. Whats also wierd is that it completely bypasses the other standard page template files, like page.php for example and lands the user directly on the index.php file in the theme folder. So basically the page templating system in my installation is not working,

I did manage to fix it by importing the db from my live installation onto my local, however last night I pushed new changes to the live copy aswell as upload new posts into the db and now the live copy is now doing the same thing.. when i got to any custom template page it lands the user on the base index.php in the theme.

I realised today that what is breaking everything, is not file or theme based, it has to do the DB and happens when I import posts. When I use the standard WP post importer, the templating engine so to speak breaks, and I can no longer access standard page templates..

Does anyone have any idea what might be causing this? and how i might be able to fix it?

i'm really nervous because i don't know if there is something fundamentally wrong with the db that will continuously break the website going forward

Any help would be greatly appreciated

i'm running WP version - 4.9.7

Thank you!

Answers (1)

2018-07-09

Arnav Joy answers:

have you checked .htaccess file ??
also try to disable all the plugins one by one and see if it solves the problem
second try is to switch to default wp theme and check .


Mike Peters comments:

Hi Arnav,

I have refreshed the htaccess on my local that didn't do anything, and yes i've tried switching themes and disabling all the plugins, it seems the problem is to do with the database somehow, the moment i upload posts into the installation it breaks the templating engine, i cant understand what in the db could be causing that


Arnav Joy comments:

can you check admin if the page template is still selected ?


Mike Peters comments:

Yes It is selected, the error just seems to overide everything and points people straight back to the index.php


Arnav Joy comments:

can you send me access to your site ?
my email is : [email protected]
I will need admin/ftp/db access


Mike Peters comments:

Hey Arnav

I would be happy to do that!, okay so the way I went about fixing was to export the posts i had using a different plugin (CSV import processes) to basically rebuild the data in a db that was working, so i got it bac up to speed, and i now realise that importing the posts thourgh the normal importing was what was breaking everything, I still dont know why it was doing that though, so that is really bugging me .

I I have to recreate my broken installation so that i can send you a link for it, but i would like to further understand it, so i'll send that you as soon as I can today

Thanks for the help!


Mike Peters comments:

Hey Arnav

I would be happy to do that!, okay so the way I went about fixing was to export the posts i had using a different plugin (CSV import processes) to basically rebuild the data in a db that was working, so i got it bac up to speed, and i now realise that importing the posts thourgh the normal importing was what was breaking everything, I still dont know why it was doing that though, so that is really bugging me .

I I have to recreate my broken installation so that i can send you a link for it, but i would like to further understand it, so i'll send that you as soon as I can today

Thanks for the help!


Arnav Joy comments:

ok Thanks :)