简体   繁体   中英

WordPress call to undefined function get_header();

Firstly, I have looked for previous posts about this topic, but none have the answer that I need. So I shall rephrase to fit my problem best.

I'm taking my first crack at creating a very basic WordPress theme. I've got all the template files that I want, and while checking my files for errors, I see that I'm getting an error for every file.

Fatal error: Call to undefined function get_header() in blah/blah/blah.....etc

I've seen many posts where people simply say "FTP a clean install" or "You moron, you changed the index.php file in the root directory!" The answer is no, this function is called in and only in my theme directory.

Any help would be HUGELY appreciated!

Thank you.

Generally this happens when someone has mistakenly put index.php from a theme in the WP install folder, where it overwrites the index.php that is the main WordPress file.

That is, the index.php that lives in the root directory (thats the directory with the wp-config.php in it) is NOT an editable theme file.

get_header()
is not a PHP function and thats why it is throwing Fatal error: Call to undefined function

 get_header()  
is a wordpress function - have you loaded the wordpress function prior to running this function - this is usually done with an include?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM