简体   繁体   中英

Error while updating to PHP 8 on Wordpress Custom Theme

I'm doing a required update to PHP 8 on the WordPress custom theme.

The suggestion from WPEngine is: to change the theme back to the default one, disable all plugins, update to PHP 8, then switch back to the custom theme.

I tried the same steps but the result was a blank page (sometimes the page below), and the Console tab showed "Failed to load resource: the server responded with a status of 500 ()" 在此处输入图像描述

在此处输入图像描述

Does anyone have the experience to resolve this? Any suggestions would be appreciated.

Update : A few of error logs

PHP Warning: Constant WP_POST_REVISIONS already defined in /nas/content/live/recession/wp-config.php on line 113

PHP Fatal error: Uncaught Error: Call to undefined function pll_register_string() in /nas/content/live/recession/wp-content/themes/recession/functions.php:91

#10 /nas/content/live/recession/index.php(17): require('/nas/content/li...')

auditor:event=wp_login {"user_id":11,"blog_id":1,"event":"wp_login","current_user_id":0,"remote_addr":"90.13.800.12"}

Should I ignore errors from live ? I believe it's the error while I attempted to preview the site.

A few notes for some newbies (like myself) while updating the custom theme to PHP 8.0:

  • If the custom theme breaks the whole webpage, you can check the Error logs tab (in WPEngine for example) and search for errors that start with PHP Fatal Error , which are most likely the causes that break your website.

  • For instance, in my case, there's this error Uncaught TypeError: Unsupported operand types: string + string , which triggered the Fatal error message (It's because the previous dev has used string + number ). All I need to do was to change it to $var1. (string)$var2 $var1. (string)$var2 and it pretty much solved the issue.

  • After fixing all the Fatal Error , the website was back online.

The error in the image you sent indicated that something is messed up with the theme, usually "Fatal error". Maybe you can check which lines that caused this error in WPEngine perhaps?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM