2024.8.23|テーマをVer4.1.5.7にアップデートしました
トラブル解決

Warning: Declaration of CASConditionPlaceholder..のエラーが出た時の対処方法

この記事は約2分で読めます。

エラーの内容

「Content Aware Sidebars(プラグイン)」のバージョンを3.16に更新すると以下のエラーコードが管理画面上部に表示される

Warning: Declaration of CASConditionPlaceholder::filter_excluded_context($posts) should be compatible with WPCAModule_Base::filter_excluded_context($posts, $in_context = false) in /home/***/***/public_html/wp-content/plugins/content-aware-sidebars/conditions/placeholder.php on line 115

対処方法

6/15 20:45追記

プラグインのバージョンを3.16.1に更新するとエラーが解消されるようです。

  1. 管理画面サイドメニューからプラグイン>プラグインエディターを開く
  2. 画面右上の「編集するプラグインを選択」で「Content Aware Sidebars」を選択
  3. 画面右側のプラグインファイルからconditions>placeholder.phpを開く
  4. 115行目あたりにあるコードを以下のように追記してファイル保存する
    • 保存できない場合はサーバーのWAF設定を無効にする
追記前
public function filter_excluded_context($posts)

追記後
public function filter_excluded_context($posts, $in_context = false)

追記後の画面

補足

  • エラーが出るか否かはサーバーによって異なる
    • Conoha・エックスサーバーではエラーが発生
    • Mixhostではエラーが表示されない
  • エラーが発生した時のみ上記方法にて対応
  • 対象のプラグイン(Content Aware Sidebars)をアップデートした際に同様のエラーが出た場合も同様の対処をする