古いWordPressのPHP5.xから PHP7.xにアップデートしてエラーになった場合の対処方法
古いWordpressをアップデートしたら
- エラー
で困ってないだろう?
大丈夫エラー内容によってはすぐ直るから安心してほしい。
どうも!15年間ウェブ制作に携わっているよこやまです。
今日はクライアント案件で古いWordpressを新しくバージョンアップしようとするとエラーがでるので、解決します。
PHP5をPHP7へアップデートしてエラー
WordPressのログイン画面なんかに
Warning: Declaration of description_walker::start_el(&$output, $item, $depth, $args) should be compatible with Walker_Nav_Menu::start_el(&$output, $item, $depth = 0, $args = Array, $id = 0) in /home/xxx/xxx.xxx/public_html/xxxxx/wp-content/themes/xxxxxx/functions.php on line 0
こんなエラーが出てたらすぐ直せる!
WordPressのエラーを修正する場所は
start_el(&$output, $item, $depth, $args)
functions.php にあるこの部分を修正すればOK。
エラーを修正する方法
- functions.phpを開く
- functions.phpにある start_el を検索する
- start_el(&$output, $item, $depth, $args)が見つかるので
- start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)へ修正する
これで解決だ。
具体的な部分はこの辺にある
class description_walker extends Walker_Nav_Menu {
// function start_el(&$output, $item, $depth, $args) {
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {
こうやってWordpressのエラーを修正すれば完了。
一瞬Wordpressのエラーで焦るけど大丈夫。確実に直していきましょう!
あなたは以下のことで悩んでないだろうか?
「ワードプレスの勉強で使いこなせなくて困っている」
「近い将来に向けてスキルアップし収入を増やしたい人」
「エンジニアとして働きたい、転職したい」
「WordPresの学習方法がわからない」
そんなお悩みなら
あなたのお役に立てます。