Reputation: 21
I followed instruction as mentioned in Wordpress, but I still got the error and referred Google and I was shocked to see many blog have same problem and they are not fixed yet and those blogs are indexed in Google, please try searching "Call to undefined function require_wp_db()" or find here
Any advice how to fix? Thanks in advance
Upvotes: 0
Views: 5530
Reputation: 7523
This question might have been misplaced on this site, but the cause of this error could be a general programming bumble.
Your problem could stem from ambiguous include paths. When using include / require / include_once / etc... if the filepath is not absolute, the file that gets included might not be the one intended. Read why here. To fix an ambiguous include directive, prefix the relative path with dirname(__FILE__).'/'
.
A plugin or even your theme could be the culprit. A regex like this could help you find cases of this: (include|require)(\_once)?\s*\(?\s['"][^\/]
I had a Wordpress theme for a multisite install that included a file like so:
require_once('sites.php');
Because sites.php was a file in the same directory, (and because the server's include path included "." -- the current directory), it worked.
However, because sites.php also existed at /wp-admin/network/sites.php, so this line caused the following error when trying to access the network dashboard:
Fatal error: Call to undefined function _get_list_table() in /www/OCE/WEBEDITOR2/wp-admin/network/sites.php on line 19
After trying the instructions in the other answer to no avail, I fixed my problem by finding and changing this line to:
require_once( dirname(__FILE__).'/sites.php' );
Note: In most, cases, Mark's suggested solution should be employed first in trying to fix this error after upgrading Wordpress, if only to eliminate other possible issues.
Upvotes: 0
Reputation: 13076
This will occasionally occur if you do not upload wp-config.php or all of the other files that have changed between versions.
Download a clean copy of the WP version you are trying to upgrade from the WP Release Archive.
Update wp-config.php with your database details, secret keys, etc.
Delete all files except for /wp-content on your server (hopefully you have kept all of your custom enhancements relegated to the /wp-content/themes directory as they recommend - otherwise you will have to diff against each individual file unless you've kept good track of your changes).
Upload all of the clean files except for the /wp-content directory
Run /wp-admin/upgrade.php
Upvotes: 2