Simplicity2がPHP8でエラーになる

[25-Apr-2024 08:29:14 UTC] PHP Fatal error:  Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in /*****/wp-content/themes/simplicity2/functions.php:376

PHP8に上げたらエントリの詳細画面でエラーになりPHPのエラーログを確認したら上記のようになってた。

implodeのマニュアルを見ると、

Legacy signature (deprecated as of PHP 7.4.0, removed as of PHP 8.0.0):
implode(array $array, string $separator): string

https://www.php.net/manual/en/function.implode.php

のため。ということで、functions.phpの376行目の引数の順番を変更。

$keywords = implode(',', $category_names);

ほかの箇所は引数の順番が新しい仕様に準拠してるので問題ないようです。

シェアする

  • このエントリーをはてなブックマークに追加

フォローする