WordPress plugin update kills site (2.4.6 --> 2.4.7 and 2.4.8)

AI-generated summary

The WordPress plugin WP-Discourse 2.4.6 works fine, but updating to 2.4.7 or 2.4.8 causes a critical error on the entire multisite network. The error occurs due to a call to the undefined function register_block_type_from_metadata() in the comments.php file, which was introduced in WordPress 5.5.0. The site is currently running WordPress 5.4.1 and PHP 5.6.40, which are outdated.

John-ISMRM mentions that there are themes in use on the multisite network that cannot be updated and break when trying to update WordPress or PHP. Jagster and RGJ suggest that the real issue is the outdated PHP and WordPress versions, and that the site should be updated to a compatible version.

RGJ points out that the WP-Discourse plugin page should be updated to reflect the required WordPress version, which is currently stated as 4.7 or higher, but should be updated to 5.5 or higher. Canapin suggests that making the theme PHP 7+ compatible might be a simple fix, requiring only a few lines of code.

I have the WP-Discourse plugin running on a WordPress multisite. Two sites within the network use it for SSO for two different Discourse sites. Other network sites don’t use the plugin. It works fine through version 2.4.6, but beyond that it results in a critical error on the whole network. After the 2.4.7 update failed, I waited for the next version to try again, but same issue.

The network is running WordPress 5.4.1 and PHP 5.6.40. I mention this because I know both are old, but there are reasons we can’t upgrade either.

What do I need to do to troubleshoot this? I appreciate any pointers or tips.

Can you elaborate on that error?

EOL over 4 years ago…

Is there? Quite usually that means same as at least one abandonded custom plugin. Then your real issue is not WP-Discourse, aged broken PHP-version or leaking WordPress — you should fix ASAP that reason why you are using way too old versions.

I mean, I’m not proud of it, but there are themes in use on the multisite network that can’t be updated and that break when we’ve tried updating WordPress or PHP. For what it’s worth, our non-multisite websites are all kept up to date, only the multisite is a ****show…

I had to quickly restore the 2.4.6 version of the plugin to fix the site so I don’t have much detail. I’ll see if I can reproduce the problem briefly with logging turned on.

Here are all the relevant errors and warnings:

[06-Jan-2023 18:11:10 UTC] PHP Fatal error:  Call to undefined function register_block_type_from_metadata() in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/blocks/comments/comments.php on line 46

[06-Jan-2023 18:11:10 UTC] PHP Fatal error:  Call to undefined function register_block_type_from_metadata() in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/blocks/comments/comments.php on line 46

[06-Jan-2023 18:11:12 UTC] PHP Fatal error:  Call to undefined function register_block_type_from_metadata() in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/blocks/comments/comments.php on line 46

[06-Jan-2023 18:11:12 UTC] PHP Fatal error:  Call to undefined function register_block_type_from_metadata() in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/blocks/comments/comments.php on line 46

[06-Jan-2023 18:11:14 UTC] PHP Fatal error:  Call to undefined function register_block_type_from_metadata() in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/blocks/comments/comments.php on line 46
[06-Jan-2023 18:11:32 UTC] PHP Fatal error:  Class 'WPDiscourse\DiscourseComment\DiscourseComment' not found in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/wp-discourse.php on line 70

[06-Jan-2023 18:11:32 UTC] PHP Warning:  Missing argument 2 for WPDiscourse\Logs\Logger::create(), called in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/discourse-base.php on line 62 and defined in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/logs/logger.php on line 37
[06-Jan-2023 18:11:32 UTC] PHP Warning:  Missing argument 2 for WPDiscourse\Logs\Logger::create(), called in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/discourse-base.php on line 62 and defined in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/logs/logger.php on line 37
[06-Jan-2023 18:11:32 UTC] PHP Warning:  Missing argument 2 for WPDiscourse\Logs\Logger::create(), called in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/discourse-base.php on line 62 and defined in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/logs/logger.php on line 37
[06-Jan-2023 18:11:32 UTC] PHP Warning:  Missing argument 2 for WPDiscourse\Logs\Logger::create(), called in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/discourse-base.php on line 62 and defined in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/logs/logger.php on line 37
[06-Jan-2023 18:11:32 UTC] PHP Warning:  Missing argument 2 for WPDiscourse\Logs\Logger::create(), called in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/discourse-base.php on line 62 and defined in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/logs/logger.php on line 37
[06-Jan-2023 18:11:32 UTC] PHP Warning:  Missing argument 2 for WPDiscourse\Logs\Logger::create(), called in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/discourse-base.php on line 62 and defined in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/logs/logger.php on line 37
[06-Jan-2023 18:11:32 UTC] PHP Warning:  Missing argument 2 for WPDiscourse\Logs\Logger::create(), called in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/discourse-base.php on line 62 and defined in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/logs/logger.php on line 37
[06-Jan-2023 18:11:32 UTC] PHP Warning:  Missing argument 2 for WPDiscourse\Logs\Logger::create(), called in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/discourse-base.php on line 62 and defined in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/logs/logger.php on line 37

[06-Jan-2023 18:11:33 UTC] PHP Warning:  Missing argument 2 for WPDiscourse\Logs\Logger::create(), called in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/discourse-base.php on line 62 and defined in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/logs/logger.php on line 37
[06-Jan-2023 18:11:33 UTC] PHP Warning:  Missing argument 2 for WPDiscourse\Logs\Logger::create(), called in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/discourse-base.php on line 62 and defined in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/logs/logger.php on line 37
[06-Jan-2023 18:11:33 UTC] PHP Warning:  Missing argument 2 for WPDiscourse\Logs\Logger::create(), called in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/discourse-base.php on line 62 and defined in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/logs/logger.php on line 37
[06-Jan-2023 18:11:33 UTC] PHP Warning:  Missing argument 2 for WPDiscourse\Logs\Logger::create(), called in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/discourse-base.php on line 62 and defined in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/logs/logger.php on line 37
[06-Jan-2023 18:11:33 UTC] PHP Warning:  Missing argument 2 for WPDiscourse\Logs\Logger::create(), called in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/discourse-base.php on line 62 and defined in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/logs/logger.php on line 37
[06-Jan-2023 18:11:33 UTC] PHP Warning:  Missing argument 2 for WPDiscourse\Logs\Logger::create(), called in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/discourse-base.php on line 62 and defined in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/logs/logger.php on line 37
[06-Jan-2023 18:11:33 UTC] PHP Warning:  Missing argument 2 for WPDiscourse\Logs\Logger::create(), called in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/discourse-base.php on line 62 and defined in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/logs/logger.php on line 37
[06-Jan-2023 18:11:33 UTC] PHP Warning:  Missing argument 2 for WPDiscourse\Logs\Logger::create(), called in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/discourse-base.php on line 62 and defined in /var/www/vhosts/groups.ismrm.org/httpdocs/wp-content/plugins/wp-discourse/lib/logs/logger.php on line 37

I don’t know anything, but I’ve seen very similar errors on WordPress when PHP is way too old (or too new, that is an issue every now and then too)

That function was introduced in Wordpress 5.5.0 so there you have it. Wordpress 5.5 is over 2.5 years old. You should really address the “reasons” that are blocking you from upgrading and upgrade Wordpress (and PHP).

Either the plugin or the Wordpress theme is going to break, and the theme is the one that doesn’t work on a current Wordpress. So to put it bluntly, this is a problem of the theme and not of the WP Discourse plugin.

If that’s the case, and if there’s no intention to make it backwards-compatible as before, then the WP-Discourse plugin page needs to be updated to state “Requires WordPress Version: 5.5 or higher.” It currently states “4.7 or higher.”

I don’t know what WP theme you use, but sometimes (I’ve been through it), making a theme PHP 7+ compatible is a matter of a few lines of code to fix.