ログイン履歴を記録することができる、WordPressプラグイン「Crazy Bone (狂骨)」をよく使うのですが、画像リンク切れエラーがあって毎回調べているので修正方法をメモ。
エラーの内容
以下の画像のように、zz.pngという画像が無いよってことで、404 Not Foundが出力される。
放っておいても特に不具合は無いのですが、なんか気持ち悪いので毎回修正してます。
Google Chromeのデベロッパーツールのエラー内容のキャプチャ
エラーを修正する方法
「Crazy Bone (狂骨)」のプラグインファイルを直接修正します。
プラグインファイルを直接修正するということはあまりやりたくない方法ですが、だいぶ更新が滞っているので今回はこの方法をとります。
wp-content/plugins/crazy-bone/plugin.php
の455行目のdetect_countryという関数のコードを以下のコードに書き換える。
※コード書き換え前には、ファイルのコピーをとっておくことをお勧めします。
1 2 3 4 5 6 7 8 9 | public static function detect_country($ip) { static $detect_countries; if ( !isset($detect_countries) ) $detect_countries = new DetectCountriesController(); list($country_name, $country_code) = $detect_countries->get_info($ip); if ( empty($country_code) || $country_code == 'ZZ' ) $country_code = 'UNKNOWN'; return array($country_name, $country_code); } |
↓これは書き換え前の不具合のあるコード
1 2 3 4 5 6 7 8 9 | public static function detect_country($ip) { static $detect_countries; if ( !isset($detect_countries) ) $detect_countries = new DetectCountriesController(); list($country_name, $country_code) = $detect_countries->get_info($ip); if ( empty($country_code) ) $country_code = __('UNKNOWN', self::TEXT_DOMAIN); return array($country_name, $country_code); } |
参考サイト
https://devilab.net/archives/1239