WordPressのログインエラーメッセージのログインヒントを無効化したいですか?
WordPressのログインページでは、ログインに失敗すると初期設定でエラーメッセージが表示されます。これらのメッセージは、意図せずハッカーがあなたのログイン情報を推測する手助けをしてしまう可能性があります。
この投稿では、WordPressのログインエラーメッセージのログインヒントを無効化し、サイトを安全に保つ方法をご紹介します。
WordPressのログインエラーメッセージにおけるログインヒントとは?
誰かが間違ったユーザー名やパスワードを使ってサイトにログインしようとするたびに、WordPressはログイン画面にエラーメッセージを表示します。
この人が間違ったユーザー名やメールアドレスを入力した場合、WordPressは次のエラーを表示します:’ユーザー名はこのサイトに登録されていません。ユーザー名が不明な場合は、代わりにメールアドレスを試してください’。
これは本物のユーザーには便利かもしれないが、ハッカーには間違ったユーザー名を入力していることを知らせることにもなる。
正しいユーザー名を入力しても、パスワードが間違っているとエラーになります。パスワードをお忘れですか?これにより、潜在的な攻撃者に正しいユーザー名を推測させることができます。
誰かがあなたのユーザー名を推測しようとしている場合、このエラーメッセージは、彼らがそれを推測することに成功したことを確認します。あとはパスワードを推測するか盗むだけです。
WordPressサイトの所有者は、ユーザー名の代わりにメールアドレスを使用してサイトにログインすることもできます。これは、ハッカーがWordPressアカウントに使用しているアドレスを把握するために、異なるメールアドレスを入力する可能性があることを意味します。
ハッカーが正しいメールアドレスを推測するとすぐに、WordPressは「ユーザー名に入力したパスワードが間違っています」というエラーに切り替わる。
WordPressブログやサイトをハッカーから守るために、アカウントには常にユニークなユーザー名と強力なパスワードを使用する必要があります。
サイトに他のWordPressユーザーや投稿者を追加した場合は、WordPressプラグインを使用してユーザーに強力なパスワードを作成させることもできます。
これらの手順は素晴らしいスタートですが、ログインヒントはまだハッカーがあなたのサイトに侵入するのを助ける可能性があります。このことを念頭に置いて、WordPressのログインエラーメッセージのログインヒントを非表示にする方法を見てみましょう。
簡単にできるように、WordPressのログインエラーメッセージのログインヒントを無効化する方法のチュートリアル動画を作成しました。
文書による説明がお好きな場合は、以下のWordPressエラーメッセージからログインヒントを削除する方法のステップバイステップのチュートリアルをご覧ください。
WordPressでログインヒントを非表示にする
WordPressのログインエラーメッセージでログインヒントを無効化する最も簡単な方法は、WordPressにコードを貼り付けることです。通常、初心者の方にはお勧めしませんが、WPCodeを使えば誰でも簡単にWordPressサイトにコードを追加することができます。
以下のコード・スニペットをサイトのfunctions.phpファイルの一番下に追加することもできますが、これはサイトを壊す可能性があります。
無料のWPCodeプラグインのインストールをお勧めします。詳しい手順については、WordPressプラグインのインストール方法をご覧ください。
すべて、WordPress管理ダッシュボードのCode Snippets “+AddSnippetにアクセスするだけです。Add Your Custom Code」にマウスオーバーし、「Use Snippet」をクリックします。
function no_wordpress_errors(){
return 'Something is wrong!';
}
add_filter( 'login_errors', 'no_wordpress_errors' );
このコードは初期設定のログインページエラーを‘Something is wrong!’のようなカスタマイザーメッセージに変更します。
このコードは、WordPressに初期設定のエラーメッセージの代わりにカスタマイザーメッセージを表示するよう指示するもので、上記のコード例ではエラーメッセージとして’Something is wrong!’を使用しています。
この行を変更して、好きなメッセージを表示させることができる。例えば、ここではエラーメッセージとして「Something is wrong!
return 'Something is wrong!';
コードタイプ」のドロップダウンからPHPを選択し、スイッチを「有効化しない」から「有効化する」に切り替えて、「スニペットを保存」をクリックする。
それができたら、新しいエラーメッセージをテストすることをお勧めします。このテストを行うには、あなたのサイトのログインページに向かい、間違ったユーザー名、パスワード、メールを入力するだけです。そして、「ログイン」ボタンをクリックしてください。
WordPressは新しいエラーメッセージを表示しますが、何が間違っているのかについてのヒントは表示しません。
このコードはWordPressのログインヒントを無効化しますが、より高度な試みや総当たり攻撃からあなたを守ることはできません。
ハッカーによるサイトへの侵入を阻止する最も簡単な方法は、SucuriやWordFenceのようなWordPressセキュリティ・プラグインを使うことだ。
WordPressのログインエラーメッセージからログインヒントを非表示にする方法について、この投稿がお役に立てば幸いです。最高のマネージドWordPressホスティングや WordPressセキュリティのエキスパートガイドもご覧ください。
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Syed Balkhi says
Hey WPBeginner readers,
Did you know you can win exciting prizes by commenting on WPBeginner?
Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
You can get more details about the contest from here.
Start sharing your thoughts below to stand a chance to win!
Thomas Maier says
Hello how can i translate the code above in different languages? I need it for the woocommerce login for the customers.
WPBeginner Support says
You would want to change the ‘Something is wrong!’ text to the text you want but if you want the text to change into multiple languages, that would require a bit more coding than we would have for a beginner article. In that case you would want to take a look at multilingual plugins.
管理者
Vahn says
Thank you loads! I spent hours looking for the place to change this.
WPBeginner Support says
Glad our guide was helpful
管理者
Izzy says
When I add this to my WpTouch plugin, it shows a part of the code in my header…
WPBeginner Support says
As long as the code is working on the desktop version you would want to reach out to WPTouch to let them know about that issue to take a look.
管理者
Anand says
Well it is easy to know the username if it is right, as when entered correct username and the wrong password, the username field does not get blank even after getting the ‘something is wrong’ warning. Which clearly is a hint the yes this is the correct username. Is there any way to make the username field blank in this scenario. Please help.
Shane says
Is there a way to change the text of the error message on the lostpassword page that says by default, “Please enter your username or email address. You will receive a link to create a new password via email.”?
I can’t seem to find any material on the subject
Nick says
I was wondering the same thing. Why can’t we just change the wording of the error message instead of adding a function that might be overwritten with the next update?
Paco says
The only thing is that when you enter a correct username and an incorrect password, it gives a message “something is wrong” but you can see the username, which confirms it in case you have guessed it. I don´t know if this happens in WordPress 4.5. Is there any way of leaving the username field blank even though it´s correct? Thank you
maudenicholson2 says
I am curious to find out what blog system you’re using? I’m having some small security issues with my latest website and I would like to find something more safeguarded. Do you have any solutions?
WPBeginner Support says
We are using WordPress with Sucuri.
管理者
freyaewu73605919 says
I am truly thankful to the owner of this web page who has shared this enormous article at at this time.
deneengranger says
Do you have any video of that? I’d like to find out some additional information.
WPBeginner Support says
Video will be available soon. Please subscribe to our YouTube Channel.
管理者
Bob says
WP Simple Firewall or Shield gives you the ability to hide the login menu, lock down the Dashboard and it comes with Sucuri and Brute Attack prevention. It is a free plugin, use it in conjunction with a password manager, so you don’t forget or misplace your passwords. I use Lastpass, which is also free. Shield replaced six security plugins and sped up my website.
Phillip George says
Is there a help line in Australia as I have forgotten my user name for logon being a little old it is a problem
Bob says
G’day Phillip, sorry mate no help line. Try going through whoever hosts your website, they should be able to help you out. Once reset use a password manager like Lastpass, you only have to remember one password. WRITE IT DOWN; did I say write it down because if you don’t, WRITE IT DOWN you’ll really will be up the creek, without a paddle.