AIO WP Securityプラグインでのログインエラー
2024年2月11日現在、WordPressのAll In One WP Securityプラグインをインストールしている場合、ログインエラーが発生し、ログインできなくなることがあります。
ログイン時に以下のようなエラーが表示される場合、WordPressプラグインが原因のエラーです。
Fatal error: Uncaught Error: Call to undefined function get_active_blog_for_user() in /home/iwb/iwb.jp/public_html/wp-content/plugins/all-in-one-wp-security-and-firewall/classes/wp-security-user-login.php:670 Stack trace: #0 /home/iwb/iwb.jp/public_html/wp-includes/class-wp-hook.php(320): AIOWPSecurity_User_Login->wp_logout_action_handler(0) #1 /home/iwb/iwb.jp/public_html/wp-includes/class-wp-hook.php(340): WP_Hook->apply_filters(false, Array) #2 /home/iwb/iwb.jp/public_html/wp-includes/plugin.php(510): WP_Hook->do_action(Array) #3 /home/iwb/iwb.jp/public_html/wp-includes/pluggable.php(670): do_action('wp_logout', 0) #4 /home/iwb/iwb.jp/public_html/wp-content/plugins/google-authenticator/google-authenticator.php(620): wp_logout() #5 /home/iwb/iwb.jp/public_html/wp-includes/class-wp-hook.php(320): GoogleAuthenticator->check_otp(Object(WP_User), 'GoogleAuthenticator...') #6 /home/iwb/iwb.jp/public_html/wp-includes/plugin.php(200): WP_Hook->apply_filters(Object(WP_User), Array) #7 /home/iwb/iwb.jp/public_html/wp-includ in /home/iwb/iwb.jp/public_html/wp-content/plugins/all-in-one-wp-security-and-firewall/classes/wp-security-user-login.php on line 670 このサイトで重大なエラーが発生しました。対応手順については、サイト管理者のメール受信ボックスを確認してください。 WordPress のトラブルシューティングについてはこちらをご覧ください。
※ iwb.jpのセキュリティーの都合上、エラー文言の内容は一部改変してあります。
ログインエラーの解決方法
Fatal errorにも示されているように、私(iwb.jp)の場合はWordPressのAll In One WP SecurityプラグインとGoogle Authenticatorプラグインの機能の競合によるものです。
そのため、プラグインを無効化すれば、ログインできるようになります。
ログインができず、WordPressの管理画面にアクセスできないので、WordPressの「wp-content/plugins/」ディレクトリ内にある「all-in-one-wp-security-and-firewall」ディレクトリを「all-in-one-wp-security-and-firewall_disabled」とリネームしてください。
プラグインのディレクトリをリネームすることで、WordPressがこのプラグインを読み込めなくなり、無効化となります。
以下のようにプラグインのディレクトリを変更すればログイン可能になる wp-content/plugins/all-in-one-wp-security-and-firewall/ ↓ wp-content/plugins/all-in-one-wp-security-and-firewall_disabled/
Google Authenticatorとの相性の問題
私の場合は、All In One WP SecurityとGoogle Authenticatorプラグイン間の相性の問題がエラーの原因でした。
そのため、Google Authenticatorプラグインのディレクトリをリネームすることでもログインエラーが解消されます。
以下のようにプラグインのディレクトリを変更すればログイン可能になる wp-content/plugins/google-authenticator/ ↓ wp-content/plugins/google-authenticator_disabled/
Google Authenticatorは、WordPressのログイン画面に2FA(2要素認証)を追加するプラグインです。
Google Authenticatorは2年前から更新が停止しており、今回の問題はGoogle Authenticatorプラグインの方により大きな問題があります。
ログイン画面で2FAを引き続き使用したい場合は、Google Authenticatorプラグインをアンインストールし、代わりに同じ2FA機能を提供する「miniOrange's Google Authenticatorプラグイン」の使用をオススメします。
miniOrange's Google Authenticatorプラグインは現在も定期的に更新されており、All In One WP Securityプラグインとの機能競合が発生せず、ログイン時のエラーを引き起こしません。
miniOrange's Google Authenticator