Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJulian Ptak
30,920 PointsDatabase Problems - Building a Wordpress Theme
Ugh... hours of work down the drain. So I stumbled across a fault in my code somewhere through the course of the project (I'm roughly halfway through) and I tried to skip past it to keep my momentum up. To do this, I downloaded the project files and replaced all of my files with all of the project files. Now of course, I realize that I had named my database something different than what Zac named his. Is there any way to connect this new project to the old database and thus save myself the trouble of starting from scratch?
3 Answers
Juan Jose Cortes Guzman
7,894 PointsYes you can, just edit the wp-config.php file. There is where all the values for connection to the database are setup.
Julian Ptak
30,920 PointsWhen I try that, it tells me to install wordpress again. I did but the custom fields and post types I created are all gone. Any suggestions?
Juan Jose Cortes Guzman
7,894 PointsWell I think think you can recover what's inside the database at least. The custom fields might be recovered as well, what I'm not so sure is about the post types. Did you run some backup before the replacing of the files?
Julian Ptak
30,920 PointsNope... I was pretty darn sure I was fixing the issue by using Zac's code. I guess I could save the new php files and put them aside and skip through the videos and just do all the edits that he does to the admin section. Gosh though... Wordpress is a bit of a pain.
Juan Jose Cortes Guzman
7,894 PointsHmmm the only thing that comes to my mind for now is exporting the current database via phpMyAdmin and then try to do a Manual Recovery but only up to the second step. Once that's done edit the wp-config.php file of the fresh install to match the user name and password for the database, don't forget to include the salts. That should fix the most of the problem.
Julian Ptak
30,920 PointsThanks. I'll give that a shot. I appreciate it.
Juan Jose Cortes Guzman
7,894 PointsI hope it helps.