Support » Fixing WordPress » Fatal error: Call to undefined function wp() in wp-blog-header.php

  • Hi folks.

    Is there a more straightforward solution available than what’s been shared at

    Here’s my problem:

    I’m moving my blog from Bluehost to Hostnine but I get this error msg…

    Fatal error: Call to undefined function wp() in /home/ghnet/public_html/wp-blog-header.php on line 14

    Here’s what I did…

    1. At the domain at Hostnine, I created a new sql database (wordpressgh1.sql) and user (gary), and assigned it all privileges.

    2. I used PHPmyadmin to import the findgood_wrdp1.sql file from Bluehost.

    3. It all looked fine, plugins activated, displaying okay, change of theme worked fine, etc.

    4. But when I tried to connect the new blog (with only the Hello World post) with imported .sql file, I got this error message:

    Fatal error: Call to undefined function wp() in /home/ghnet/public_html/wp-blog-header.php on line 14

    I attempted to fix things by following various tips from various forums but nothing I tried worked, so I used Fantastico to uninstall WordPress and then to reinstall it. The default blog looked fine.

    I uploaded a new theme and that worked just fine. I uploaded my plugins and activated them okay.

    (Am I missing a step here??)

    Then, the second time around, I changed the wp-config.php to insert the 3 identifying details for the new .sql file (wordpressgh1.sql) which I had uploaded using PHPmyadmin — and that triggered the error msg about an undefined function wp() in wp-blog-header.php

    So… here is the ORIGINAL wp-config.php as created by Hostnine’s Fantastico:

    define(‘DB_NAME’, ‘ghnet_wrdp1’);
    define(‘DB_USER’, ‘ghnet_wrdp1’);
    define(‘DB_PASSWORD’, ‘*********’);

    And here are the NEW entries I pasted in:

    define(‘DB_NAME’, ‘ghnet_wordpressgh1’);
    define(‘DB_USER’, ‘ghnet_gary’);
    define(‘DB_PASSWORD’, ‘**************’);

    See any errors?

    Are both webhosts using the same versions?
    PHP5.2.9 – same on both
    WP2.7.1 – same on both

    Each time I upload the NEW dbase name/user/pwd, I get the error msg. When I replace them with the ORIGINALS, the site displays just fine. This is also true when using the default WP theme, Kubrick.

    So…….. after this long story, I have run out of ideas. Googling has not led me to the answer yet, either.

    Can anyone here help me out, please.


    I checked the wp-blog-header.php file on other functional blogs (on another host) and that file is not the problem here.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The support folks at Hostnine point out that Fantastico’s install process produced a working WP blog so it’s not an issue with their their servers.

    Looks to me like a bug in WP, but that’s just my uneducated guess.

    Hoping for a swift and effective solution. Thanks.



    1) Are you positive you have all of the WP 2.7.1 files uploaded at Hostnine?

    2) I lost track of what you have current, between your Fantastico and backup installations. It sounds like WP is not finding the WP files in the locations its looking for them. Did you change the folder or root installation choices between Bluehost and Hostnine? Because if you restored the old SQL database yet installed WP in a different location that it had been on Bluehost, that would explain why it’s not finding function wp(), which is in /wp-includes/classes.php, one of the core WP files.

    This is not a bug in WP – if it was hundreds of people would experience it. More likely you’ve inadvertently told WP to look for its files in the wrong place.

    You can override the location settings stored in the database by adding these lines to wo-config.php

    define('WP_SITEURL', '');
    define('WP_HOME', '');

    substitute your actual install folder and domain for the example code. Point WP to where its files are located. That will likely resolve this.

    that’s wp-config.php not wo-config.php sorry for typo

    Firstly, thanks stvwlf for answering here.

    I checked /wp-includes/classes.php – yes, it’s there on the new server. Here are the relevant lines from that file.

    * PHP4 Constructor – Does nothing.
    * Call main() method when ready to run setup.
    * @since 2.0.0
    * @return WP
    function WP() {
    // Empty.

    So that didnt need changing.

    However we have GREAT NEWS from your other suggestion. Adding those 2 lines into the wp-config.php file made no difference on its own but when I replaced the old database name + user name + password with those details for the new database, the content from the old site is now displaying perfectly on the new site.



    If you want the end of the story here…

    Thanks again, Steve.


    thank you Gary

    Steve, I wonder if I can tap into your brain again…

    At I have successfully imported the old dbase and it shows as the home page but when you click on the link to any other post, you get this error message:

    Not Found

    The requested URL /how-to-build-and-publish-your-first-web-site/ was not found on this server.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
    Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/ Server at Port 80

    I figured that since it was part of the old site which is now uploaded and connected via wp-config.php (with the extra 2 lines you suggested), it should be showing. But it’s not.

    Mystified again,


    Go to Admin / Settings / permalinks

    take note of what your permalinks are set to.
    change them to the default, and update. See whether you are still getting 404’s. If not, reset your permalinks to what they were before the reset.

    That process forces WP to rewrite the htaccess file and often clears issues like this.

    Once again you hit the nail on the head, Steve.

    Steve The Magnificent…!!

    Big thanks again, my friend.

    Here’s a random recent post just to show it’s working…


Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Fatal error: Call to undefined function wp() in wp-blog-header.php’ is closed to new replies.