[Fixed] WordPress site has error after upgrading to PHP 8.2 – Php

Alexei Petrov
angular-upgrade composer-php php-8.2 twentytwenty wordpress

Quick Fix: To resolve this issue, you can try the following as a quick fix:

  1. Uninstall or disable WordPress Meta Robots plugin until a suitable fix or update is available.
  2. You can troubleshoot further by inspecting your site’s plugins and examining their compatibility with PHP 8.2.
  3. Consider rolling back to a previous PHP version until you have a chance to thoroughly test and ensure compatibility with your site’s setup.
  4. If you’re unable to find any plugins causing issues, you can examine your custom code or theme for compatibility issues.

The Problem:

After upgrading the PHP version of a WordPress site from 7.4 to 8.2, the site encountered an error related to a callback in the wp-meta-robots-plugin::meta_robots_addcolumn() function. Despite updating themes, plugins, and the WordPress core, the error persists, even when switching to a different theme. The error message mentions a call_user_func_array() function issue and points to a specific line in the wp-hook.php file.

The Solutions:

Solution 1: Upgrade or Replace WordPress Meta Robots Plugin

The error is caused by a plugin called WordPress Meta Robots. This plugin has not been updated to comply with recent versions of PHP, particularly PHP 8.2. To resolve this issue, you have a few options:

  1. Upgrade the WordPress Meta Robots Plugin: If an updated version of the plugin is available, install it. This may fix the issue if the developer has addressed the compatibility issues.

  2. Replace the WordPress Meta Robots Plugin: If there is no updated version available or if you prefer not to use the plugin, you can replace it with an alternative plugin that provides similar functionality. There are several meta robots plugins available that are compatible with PHP 8.2.

  3. Rollback PHP to an Earlier Version: If you are unable to update or replace the plugin, you may need to roll back your PHP version to an earlier version that is compatible with the plugin. This is not recommended as it can introduce security vulnerabilities, but it may be a temporary solution until you can find a suitable replacement for the plugin.

  4. Fix the Plugin Yourself: If you are a developer or have access to a developer, you may be able to fix the plugin yourself. This involves modifying the plugin’s code to make it compatible with PHP 8.2. This is a technical solution and requires knowledge of PHP programming.

Solution 2: Upgrade to WordPress 6.3

Since WordPress only fully supports PHP 7.4, and only supports PHP 8.0 & 8.1 with exceptions, and PHP 8.2 is still in BETA, it’s likely that the error you’re encountering is due to you not having updated to WordPress 6.3 yet.

To resolve this issue, follow these steps:

  1. Back up your website’s files and database.
  2. Update to WordPress 6.3.1 by following the [detailed Upgrading WordPress Documentation](https://wordpress.org/documentation/article/updating-wordpress/).
  3. Update your plugins during the WordPress 6.3 upgrade process.
  4. Once you’ve updated to WordPress 6.3.1, you can then upgrade your PHP from 7.4 to 8.2. Keep in mind that some plugins may not support PHP 8.2, so be prepared for potential compatibility issues.

Note that your Twenty Twenty theme should work fine with PHP 8.2, as indicated by the fact that it runs without errors on a test website running on PHP 8.2.


How do I know my site contains the WordPress Meta Robots plugin?

Check for the plugin in your PHP error message.

Can I use PHP 8.2 with WordPress?

You need to update WordPress to version 6.3+ first.

Does Twenty Twenty theme work with PHP 8.2?

Yes, Twenty Twenty works fine with PHP 8.2.

Video Explanation:

The following video, titled "PHP 8: don't hesitate, make your upgrade great! - YouTube", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

PHP is the programming language that WordPress is made from, and it needs to be current in order to keep your website's code secure.