Support » Fixing WordPress » Fatal error: Call to undefined method WP_Error::has_errors()…

  • Resolved Matthew Fries

    (@brewermfnyc)


    I just tried to upgrade from 4.9.8 to 5.1.1 and have encountered a bunch of errors. Here is what has happened and what I’ve tried:

    1. Upgrade process looked like it completed, but it still showed that 4.9.8 was the current version of WP.

    2. I clicked upgrade again and encountered the error:

    Fatal error: Call to undefined method WP_Error::has_errors() in .../wp-admin/includes/file.php on line 1504

    Dashboard “at a glance” still says I’m running version 4.9.8.

    3. Also note – The front end seems to be working fine, but when I try to edit a post or page I get the following errors:

    Warning: array_reduce() expects parameter 2 to be a valid callback, function 'rest_preload_api_request' not found or invalid function name in .../wp-admin/edit-form-blocks.php on line 76
    
    Fatal error: Class 'WP_Block_Type_Registry' not found in .../wp-admin/includes/post.php on line 2196

    4. I connected to the site with FTP and deleted all WP core files. I uploaded a fresh version of WP 5.1.1 that I just grabbed off of the site here. Complete manual reinstall/upgrade.

    5. WP Admin dashboard still shows I’m currently running version 4.9.8 and all the errors I mentioned above are persisting. If I look in …/wp-includes/version.php it says:

    /**
     * The WordPress version string
     *
     * @global string $wp_version
     */
    $wp_version = '5.1.1';

    Wondering how I’m this out of sync. FWIW I’m unable to disable any plugins because I get the same error:

    Fatal error: Call to undefined method WP_Error::has_errors() in .../wp-admin/includes/file.php on line 1504

    NOTE: I replaced the sensitive part of the file locations with “…” in the errors above.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Matthew Fries

    (@brewermfnyc)

    Looks like now I’m getting the error on the login page as well. I’m unable to get to my dashboard at all now.

    Fatal error: Call to undefined method WP_Error::has_errors() in .../wp-admin/includes/file.php on line 1504

    I also confirmed with the server folks that there is no caching going on on the server.

    I am getting the same error message when trying to update wordpress to version 5.1.1. Fatal error: Call to undefined method WP_Error::has_errors() in C:\inetpub\wwwroot\wordpress\wp-admin\includes\file.php on line 1504

    I am also catching the same error on a 4.9 site.
    I get the same “Fatal error” when I try to edit a page’s content, or install a plugin.

    • This reply was modified 8 months, 4 weeks ago by mikebrylinski.

    Strangely the next morning everything was working correctly – like a cache had finally caught up, though my host swears there’s no caching going on. Since then I’m having the same problems with failed plugin updates. The last Yoast update took my whole site offline and I had to manually remove the plugin and haven’t been able to reinstall it through WordPress or manually. It’s like it halfway loads into WP and breaks.

    So – finally some answers from my web host. It turned out to be a problem with PHP on our server. Our website is using PHP-FPM and the changes we were making were not being picked up because the PHP-FPM processes needed to be restarted.

    Back in business for now…

    • This reply was modified 8 months, 3 weeks ago by Matthew Fries.

    Had the same problem. I restarted the php-fpm service in WHM and the error resolved. thanks so much!

    This worked for me. Updated from php 5.4 to 7.2 in the MultiPHP Manager in cpanel and viola. Thank you!

    ronsoftsolutionslimited

    (@ronsoftsolutionslimited)

    Same Issue with me… I just tried to upgrade from 4.9.8 to 5.1.1 and have encountered a bunch of errors. Here is what has happened and what I’ve tried:

    1. Upgrade process looked like it completed, but it still showed that 4.9.8 was the current version of WP.

    2. I clicked upgrade again and encountered the error:
    Fatal error: Uncaught Error: Call to undefined method WP_Error::has_errors() in /home/hello/public_html/wp-login.php:58 Stack trace: #0 /home/hello/public_html/wp-login.php(1045): login_header(‘Log In’, ”, Object(WP_Error)) #1 {main} thrown in /home/hello/public_html/wp-login.php on line 58

    How do we fix this issue?.
    Changed PHP to 7.2, Replaced Core Files, Nothing changes…

    ronsoftsolutionslimited

    (@ronsoftsolutionslimited)

    My front end seems to be working fine, but when I try login with /wp-admin, i get the below error;

    /home/hello/public_html/wp-login.php:58 Stack trace: #0 /home/hello/public_html/wp-login.php(1045): login_header(‘Log In’, ”, Object(WP_Error)) #1 {main} thrown in /home/hello/public_html/wp-login.php on line 58

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Fatal error: Call to undefined method WP_Error::has_errors()…’ is closed to new replies.