Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; WP_MatchesMapRegex has a deprecated constructor in /


⚠️階層ファイルがめちゃくちゃなのは、スルーしてくださいw

WordPressの自作テーマの作り方の講座を見ていて急に出て来たエラー

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; WP_MatchesMapRegex has a deprecated constructor in /Users/Sites/bootstrap_wp_udemy/B2W Final Course Files/B - Download WordPress/b2w/wp-includes/class-wp.php on line 633
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Translation_Entry has a deprecated constructor in /Users/Sites/bootstrap_wp_udemy/B2W Final Course Files/B - Download WordPress/b2w/wp-includes/pomo/entry.php on line 14
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; POMO_Reader has a deprecated constructor in /Users/Sites/bootstrap_wp_udemy/B2W Final Course Files/B - Download WordPress/b2w/wp-includes/pomo/streams.php on line 12

私が使っていたバージョン

PHP 7.3.1
WP version 4.0.1

WPのバージョンが低いとこのようなことが起きるよう。

参照URL
https://www.php.net/manual/ja/migration70.deprecated.php

解決方法

  1. バックアップ(直そうとしているファイルのコピー)をとる。理由はわからなくなって元に戻れないと怖いから。
  2. wp-config.phpとwp-contentフォルダを削除
  3. 最新のWPのバージョンをとる。私が新しくWPのバージョンをとって来たのは、5.3.2。
  4. 新しくとってきたwp-config.phpと新しいwp-contentフォルダを差し替える

参照URL
https://kotori-blog.com/wordpress/upgrade/

これでうまく行きました。
差し替えは怖かったですが、バックアップをとっておいたので安心して実行できました。
めでたし、めでたし。