WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] call to undefined function wp() (22 posts)

  1. therealcaffeine
    Member
    Posted 8 years ago #

    I've just uploaded a fresh wordpress installation to http://www.therealcaffeine.com/. When I load that page it gives me the following error:

    Fatal error: Call to undefined function: wp() in /home/content/t/h/e/thercaffeine/html/wp-blog-header.php on line 14

    I know my host's database is working, and that it can run wordpress because it has before. The same installation (albeit with different database information) worked on my local server. I've checked the forums, and I do have a wp-includes directory, where all files are present (specifically functions.php) and none are size zero. All three directories (wp-content, wp-admin, and wp-includes) have permissions 755. Is that the correct permission? And what else can I check to get my blog running?

  2. Kafkaesqui

    Posted 8 years ago #

  3. sonja1234
    Member
    Posted 8 years ago #

    Hi Kafkaesqui - sorry, but that's not actually a helpful answer.

    There are many posts and replies there but I'm having exactly the same problem as therealcaffine since moving one of my WP sites to a new host and can't find the answer. I've followed tambla's tutorial for moving and restoring, done several of the most promising suggestions in a number of the posts you point to, and all with no avail. (Spent most of Christmas trying to fix this, now banging my head on the wall!)

    It would be helpful, I think, if someone could let me and therealcaffine know where the wp function being called should be located/generated. We may then be able to track down the solution?

  4. therealcaffeine
    Member
    Posted 8 years ago #

    Kafkaesqui: as you can see from my post, I did search the forum. Didn't find anything of use though, which I thought I included in my post, but apparently not. Were there any particular posts you thought would be useful?

    sonja1234: where's that tutorial? Could you provide a link please? The WP function is located in wp-includes/functions.php. I've checked the code and there seems to be nothing wrong with it (and again, it works on my local server.) What host are you using?

  5. sonja1234
    Member
    Posted 8 years ago #

    Here's the moving tutorial:

    http://www.tamba2.org.uk/wordpress/move/

    Pretty comprehensive.

    I used to be on eMaxhosting, but have just moved over to Clook.

    I had a look for a function called wp in wp-includes/functions.php but couldn't find it, so assumed it must be somewhere else... I'll try replacing the file with a fresh one from the WP download.

  6. sonja1234
    Member
    Posted 8 years ago #

    Hmm... the old file was 64k, the new 73k, but replacing the file doesn't seem to have made any difference.

  7. sonja1234
    Member
    Posted 8 years ago #

    Have now found the wp function in the new file. It seems to call up something called $query_var Could this be where the problem is?

  8. therealcaffeine
    Member
    Posted 8 years ago #

    I can't claim to know even the basics of database programming, but that seems to be something to do with the database. Besides, WordPress claims that the function wp() can't be found, not that there's something wrong inside the actual function. Just for kicks, I'm going to comment out that line and try again. Might help, but it'll probably cripple the whole thing. Who knows, though?

    EDIT: errr... that is, comment out line 14 of wp-blog-header.php where wp() is called.

  9. sonja1234
    Member
    Posted 8 years ago #

    Commenting out the line doesn't help, does it? Just takes you to the next fuction it can't find! I'm beginning to suspect its something to do with the MySQL database setup, but I know nothing about that either.

    I have to finish for the rest of the day now. Will check back tomorrow. Good luck!

  10. therealcaffeine
    Member
    Posted 8 years ago #

    Nope, didn't help at all, as expected. This is a completely fresh install, I've removed my previous wordpress directory and the database (which I had backed up, don't worry) and nothing's still working. Everything worked in this folder before, and it's rather odd that it doesn't now...

  11. sonja1234
    Member
    Posted 8 years ago #

    Back at it again! Thinking overnight, I've gone off the idea that its to do with the database: the error message indicates that the wp-config.php is being found, but the wp function isn't being defined. As wp funtion is defined in wp-includes/functions.php, it seems there is a problem between these two files. But what? Any ideas anyone?

  12. sonja1234
    Member
    Posted 8 years ago #

    This is where the problem seems to be - WP doesn't seem to be reading the functions in functions.php. I set up one of my own, to output some text to the screen before calling wp() and wp-blog-header.php then stopped at that with the same error message.

  13. sonja1234
    Member
    Posted 8 years ago #

    Help, please! Someone must know what's happening when WP runs but doesn't seem to pick up the functions defined in wp-includes/functions.php!

  14. Samuel Wood (Otto)
    Tech Ninja
    Posted 8 years ago #

    If the call to wp() doesn't work, then your wp-config.php is broken somehow. Probably the end is cut off or you didn't close a quote or something else. Whatever it is, you probably broke it.

    Download a fresh copy of wordpress and look at the wp-config-sample.php file. Compare it with your file. That require_once at the end? It's important that you don't change it or make it not work or what have you.

  15. sonja1234
    Member
    Posted 8 years ago #

    Thanks, but I'm now a step further back :(

    I downloaded a new copy of WP, adapted the contents of the new wp-config-sample.php, renamed it to wp-config.php, ftp'd it over the one on th eserver, and now I'm getting the WP error:

    "Can’t select database

    We were able to connect to the database server (which means your username and password is okay) but not able to select the stevehar_wrdp1 database. etc." In otherwords, it's not now recognising 'localhost' (I didn't touch that) as the host.

    Am I one of the 1% who does need to change that? If so, what too?

  16. therealcaffeine
    Member
    Posted 8 years ago #

    Ooh, I'll try that soon's I get home. Thank you so much, Otto42. I've again no clue about databases, but I wish I could help.

  17. sonja1234
    Member
    Posted 8 years ago #

    Sorry, I think I'm getting confused (long day trying to sort this out :-(( ) I think the first bit of the message "We were able to connect to the database server..." means it could find 'localhost', right? But for some reason it is not recognising the database name?

  18. moshu
    Member
    Posted 8 years ago #

    means it could find 'localhost', right? But for some reason it is not recognising the database name?

    That's exactly what the message says. Check upper case/lower case - the DB name is usually case sensitive, typos...

  19. sonja1234
    Member
    Posted 8 years ago #

    Sorted! What I did was:

    1) refreshed the wp-config.php file as suggested by Otto42 (many thanks!)

    2) Added a cache folder to the wp-content directory just in case my version of WP needed it after all (I'd previously deleted it, but it doesn't look as though it is using it anyway, so this probably wasn't needed).

    3) This is what made the difference... On the cPanel MySQL page I actually hit the 'Add User to Database' button. Because the user was listed in the boxes at the top of that section I thought it had already happened when it had been set up.

    So, resolved for me. therealcaffine let us know how you get on.

  20. moshu
    Member
    Posted 8 years ago #

    3) Ah, that's a common mistake... (during my first WP install I struggled with that two nights :)

    Glad you sorted it out.

  21. therealcaffeine
    Member
    Posted 8 years ago #

    Got it all fixed up now, my site is running happily! Redoing that file fixed things right up. Good to know. I'll mark this as resolved!

  22. Axelsson
    Member
    Posted 7 years ago #

    I was trying to move some of my blogs to a new host, but there was always some kind of error.

    I found out that it was my FTP-program(Filezilla) that did something wrong when downloading/uploading the files.

    So I tried to download from the old host and upload to the new host again but with SmartFTP. And now everything seem to work just fine.

Topic Closed

This topic has been closed to new replies.

About this Topic