skip to Main Content

I tried to update the PHP of my site on WHM from PHP 7.4 to PHP 8.2.

But before updating I make sure that themes, plugins, and core WordPress are up to date.

After upgrading to PHP 8.2 I’ve got this error.

    Fatal error: Uncaught TypeError: call_user_func_array():
    Argument #1 ($callback) must be a valid callback, 
    non-static method wp_meta_robots_plugin::meta_robots_addcolumn() 
    cannot be called statically in 
     /home/fixmywri/public_html/wp-includes/class-wp-hook.php:310 
Stack trace: #0 /home/fixmywri/public_html/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters(NULL, Array)
 #1 /home/fixmywri/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
 #2 /home/fixmywri/public_html/wp-settings.php(632): do_action('init')
 #3 /home/fixmywri/public_html/wp-config.php(90): require_once('/home/fixmywri/...')
 #4 /home/fixmywri/public_html/wp-load.php(50): require_once('/home/fixmywri/...')
 #5 /home/fixmywri/public_html/wp-blog-header.php(13): require_once('/home/fixmywri/...')
 #6 /home/fixmywri/public_html/index.php(17): require('/home/fixmywri/...')
 #7 {main} thrown in /home/fixmywri/public_html/wp-includes/class-wp-hook.php on line 310

I am using the Twenty Twenty theme. I tried to switch to a different theme, but the error still persists.

What could be the problem with this?

2

Answers


  1. Currently WordPress only fully supports PHP 7.4, and it only supports with exceptions PHP 8.0 & 8.1; and PHP 8.2 is only in BETA (ie not fully supported for production).

    Your error: it leads me to believe that you haven’t updated to WordPress 6.3 yet — which you should do before updating PHP. Fortunately, the latest version of WordPress 6.3.1 fully supports PHP 7.4 — start with the detailed Upgrading WordPress Docuemnation — as part of that process you’ll also go through and update your plug ins.

    After that, then you’ll look to upgrade your PHP from 7.4 to 8.2 — but be prepared it is possible your plugins might not support PHP 8.2.

    P.S. Your theme should work fine with 8.2 as I have that running on a test website running on PHP 8.2 — and the error does not suggest that this is a plugin issue.

    Login or Signup to reply.
  2. Your site contains a plugin called WordPress Meta Robots that hasn’t been cleaned up to comply with recent versions of php. The php developers are cleaning up the language to make it more secure, and they’ve prevented certain operations like the one that caused your error.

    How do I know this? I looked at the first couple of lines of your error message where it says

    Fatal error: Uncaught TypeError: call_user_func_array():
        Argument #1 ($callback) must be a valid callback, 
        non-static method wp_meta_robots_plugin::meta_robots_addcolumn() 
        cannot be called statically in 
         /home/fixmywri/public_html/wp-includes/class-wp-hook.php:310 
    

    Then I used https://wpdirectory.net/ to search the plugin repo’s source code for meta_robots_addcolumn and boom, there it was. A non static method being called as if it were static.

    Get rid of the plugin, or get the developer to bring it into compliance, or rollback php to an earlier version, or fix it yourself.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search