Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPBカップ
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

WordPressでメールアドレスでのログイン機能を無効化する方法

編集メモ: WPBeginner のパートナーリンクから手数料を得ています。手数料は編集者の意見や評価に影響を与えません。編集プロセスについて詳しく知る。

最近、あるユーザーからWordPress 4.5で導入されたメールでのログイン機能を無効化する方法を尋ねられました。

この機能により、ユーザーはログインフォームにユーザー名またはメールアドレスを入力してログインすることができます。

この投稿では、WordPressでメールアドレスによるログイン機能を無効化する方法を紹介します。

How to Disable Login with Email Address Feature in WordPress

WordPressでメールログインを無効化する理由

ユーザーによっては、メールアドレスはユーザー名よりも常識だと考えている人もいる。誰かにメールを送れば、相手はすでにあなたのメールアドレスを知っている。

誰かがあなたのWordPressサイトに侵入しようとした場合、メールアドレスを知っていれば、パスワードを推測したり、メールアカウントをハッキングすることで、侵入が容易になる可能性があります。

私たちは、ログインにメールアドレスを使用することでWordPressサイトのセキュリティが低下するとは考えていません。WordPressの管理ディレクトリをパスワードで保護したり、二段階認証を追加するなど、セキュリティのレイヤーを増やすことはいつでもできます。

WordPressのセキュリティについては、すべてのサイトでSucuriを使用しています。Sucuriのおかげで3ヶ月で450,000件のWordPress攻撃をブロックできたことをご覧ください。

とはいえ、WordPressサイトでメールによるログイン機能を無効化したいユーザーもいることでしょう。簡単にできる方法を見てみましょう。

方法1.WordPressでコードを使用してメールによるログインを無効化する(推奨)

この方法では、WordPressファイルにコードを追加する必要があります。WordPressにスニペットを貼り付ける方法については、こちらをご覧ください。

メールでのログイン機能を無効化するには、テーマのfunctions.phpファイルまたはコードスニペットプラグインに次のコードを追加する必要があります。

remove_filter( 'authenticate', 'wp_authenticate_email_password', 20 );

さらに簡単にするには、WordPressに最適なコード・スニペット・プラグインであるWPCodeを使うことができる。

WPCode WordPress code snippets plugin

WPCodeにはビルトインライブラリがあり、メールでのログイン無効化、WordPressのバージョン番号の削除、コメントする無効化など、WordPressで最も人気のある機能リクエストに対応するコードスニペットがすべて用意されています。

一番の利点は、テーマのfunctions.phpファイルをすべて編集する必要がないことだ。

開始するには、無料のWPCodeプラグインをインストールし、有効化する必要があります。ヘルプが必要な場合は、WordPressプラグインのインストール方法についてのチュートリアルをお読みください。

プラグインを有効化したら、WordPressの管理ダッシュボードからCode SnippetsLibraryにアクセスしてください。

次に、「Disable Login by Email」スニペットを検索し、「Use snippet」ボタンをクリックします。

Search for the Disable Login by Email snippet in WPCode library

その後、WPCodeは自動的にコード・スニペットを追加し、適切な挿入方法を選択します。

WPCode automatically adds the code for disabling login by email

必要なのは、スイッチを「非アクティブ」から「有効化」に切り替えることだけだ。

そして「更新」ボタンをクリックする。

Activate and update snippet in WPCode

それだけだ!

これにより、ログインページでは何も変更されず、ユーザーはユーザー名またはメールアドレスのいずれかを使用してログインできることがわかります。しかし、メールアドレスを入力してログインすると、無効なユーザー名エラーが表示されます。

方法2.プラグインを使用してWordPressでメールによるログインを無効化する。

個別プラグインでメールによるログイン機能を無効化することもできます。

最初に行う必要があるのは、No Login by Email Addressプラグインをインストールして有効化することです。詳しくは、WordPressプラグインのインストール方法のステップバイステップガイドをご覧ください。

プラグインは箱から出してすぐに使えますし、設定も必要ありません。WordPressサイトのログイン画面にアクセスし、メールアドレスでログインしてみてください。

無効なユーザー名エラーが表示されます。プラグインはまた、「ユーザー名またはメール・アドレス」というラベルを単に「ユーザー名」に変更します。

Login with email address removed

以上、この投稿が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.

情報開示 私たちのコンテンツは読者支援型です。これは、あなたが私たちのリンクの一部をクリックした場合、私たちはコミッションを得ることができることを意味します。 WPBeginnerの資金源 をご覧ください。3$編集プロセスをご覧ください。

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

究極のWordPressツールキット

ツールキットへの無料アクセス - すべてのプロフェッショナルが持つべきWordPress関連製品とリソースのコレクション!

Reader Interactions

9件のコメント返信を残す

  1. 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!

  2. momses says

    Hi,

    Thanks for you article. I’m looking for a way to Login only By mail no Username.

    Thanks in advance for you help.

  3. Dom WO says

    Does this article also cover the registration form in woocommerce for the customers or it is only for the admin side login ?

  4. Debra says

    Somehow it isn’t clear to me how to add a username once the email address login is disabled. Can you please explain.

    Thanks so much

    • WPBeginner Support says

      If you have user registration enabled on your site, then those users can still register using their email addresses. But they will not be able to use the email address to login. They will have to use the username to login. As an administrator, you will also need to enter an email and user name when adding a new user.

      管理者

  5. Abdul Samad says

    Thank you for article

    I want to know, how to allow login with mobile number

    Second, I want to register my customer without email in wordpress

    Please help me out with this

    Thanks

  6. Jeramy Queale says

    I simply couldn’t go away your website prior to suggesting that I really loved the usual information an individual provide in your visitors? Is gonna be back frequently to check up on new posts

  7. Jayna Coppedge says

    I have a login to my wordpress blog. I have a different login for another wordpress blog I write with others. However when I want to comment on another wordpress blog. Neither user name or password works. I have not been willing to say change this long in because I am afraid it would affect the other 2. I don’t know what to call the 3 category to even look up the problem.

返信を残す

コメントありがとうございます。すべてのコメントは私たちのコメントポリシーに従ってモデレートされ、あなたのメールアドレスが公開されることはありませんのでご留意ください。名前欄にキーワードを使用しないでください。個人的で有意義な会話をしましょう。