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 trial

WordPress

Clifford Ng
Clifford Ng
5,090 Points

Error in get_header()?

I've an error using the get_header() in my local wordpress development. I've tried using the final project folder from the videos to test if it'll work without changing anything and it didn't. This is the error message it shows.

Fatal error: Uncaught Error: Call to undefined function get_header() in C:\xampp\htdocs\localwp.com\index.php:1 Stack trace: #0 {main} thrown in C:\xampp\htdocs\localwp.com\index.php on line 1

4 Answers

Tim Knight
Tim Knight
28,888 Points

Hi Clifford,

One thing that can cause that exact error is if you're pointing your server's root to the theme folder instead of the actual root folder where WordPress is installed. Or if you upzipped a theme and set it up in something like MAMP (a local webserver) and didn't actually install WordPress, you'd get that exact error as well. Do you have your local server pointing to a full installation of WordPress?

Clifford Ng
Clifford Ng
5,090 Points

Hi Tim,

Now that you mention it, I guess not. I'm currently following what the video says. Should I download the wordpress installation and then just replace the files from the project folder?

Clifford Ng
Clifford Ng
5,090 Points

Nevermind, I managed to get it solved. Thanks for your help, Tim!

Tim Knight
Tim Knight
28,888 Points

Sorry Clifford, I just saw your other comment. I'm glad you got it worked out.

Hey guys, I'm having the same problem. Clifford Ng, how did you end up fixing this?

Fatal error: Call to undefined function get_header() in C:\wamp64\www\my-web-projects\treehouse-projects\th-portfolio\wp-content\themes\dth-portfolio\page.php on line 1