Call to undefined function get_userdata in user.php

My website error log is full of

[lsapi:error] […] Backend fatal error: PHP Fatal error:
Call to undefined function get_userdata()
in /home/…/public_html/wp-includes/user.php on line 460

… and the site does not load (blank page, no source).

The only changes that were recently made are WordPress and plugin updates (I don’t know which ones and when); no programming of any kind.

This answer made me suspect that a plugin did override get_userdata, but a recursive search for function get_userdata in the wp-contentplugins folder (after downloading the entire site through FTP) finds nothing (even a manual inspection for all instances of get_userdata finds only function calls, no definitions).

wp_settings.php seems OK, relevant part:

// Load active plugins.
foreach ( wp_get_active_and_valid_plugins() as $plugin ) {
wp_register_plugin_realpath( $plugin );
include_once( $plugin );
unset( $plugin );

// Load pluggable functions.
require( ABSPATH . WPINC . ‘/pluggable.php’ );
require( ABSPATH . WPINC . ‘/pluggable-deprecated.php’ );

// Set internal encoding.

Maybe I can use this 7 year old hack in user.php, but that looks weird. Why would I have to path WordPress files?

What can be going on and how to fic it?
Of course, my primary suspects are still the plugins. Is there a way to selectively disable them. I can modify and upload php files and I can perform SQL queries on the database if need be.

Read more here:: Call to undefined function get_userdata in user.php

Leave a Reply

Your email address will not be published. Required fields are marked *