Skip to content

Warning: The magic method Predic_Widget::__wakeup() must have public visibility in というエラーについて

Wordpress のロゴが入ったコンピューターを使用している男性。

今回は、WooCommerceで作成しているページにオシャレな検索フォームを追加しようと Advanced Product Search For WooCommerce をインストールしたところ、以下のエラーが出ました。

エラーメッセージ

Warning: The magic method Predic_Widget::__wakeup() must have public visibility in wp-content/plugins/advanced-product-search-for-woo/lib/predic-widget/predic-widget.php on line 191

上記のエラーは今現在(2022年6月3日時点)ではPHP8に対応していないから生じるエラーのようです。

解決策としては、プラグインの開発者にエラーを報告してPHP8に対応するアップデートを待ちます。

待てない場合は以下の解決方法でエラーを解消し、プラグインのアップデートまで凌ぐ事ができます。

プラグインによって場所は異なると思いますが、今回のプラグイン「Advanced Product Search For WooCommerce」は wp-content/plugins/advanced-product-search-for-woo/lib/predic-widget/predic-widget.php というファイルの 191行目にあるようです。

その行では以下確認できました。

private function __wakeup() {
}

private を public に変更してエラーを解消できます。変更後、以下の通りになります。

public function __wakeup() {
}
最終更新日: 2025-12-05

この記事は役に立ちましたか?

前へ...

MIME typeエラーでサイトが崩れる(Refused to apply style from … because its MIME type (‘text/html’) is not a supported stylesheet MIME)

次へ...

エラー: The type attribute is unnecessary for JavaScript resources.