Filter to hide traditional username/password login fields

  1. Ville Mattila

    I have been searching for ways to disable the normal WP login form (username + password) as I would like to solely rely on other authentication methods on my blog. After going through the WP codebase I noticed that the there is no hooks that would make this possible. It's easy to add new fields before or after the form, but disabling username/password fields is impossible (without modifying wp-login.php -> not good idea).

    Idea about Custom logins in the theme directory would be one possibility, even though in our use case, it's a little bit too heavy.

    I would suggest to define a new filter login_show_form that could be then extended by any plugin that wants to hide the ordinary login form. Normally, the login form is shown, but if any plugin returns false for the login_show_form filter, the login form would be hidden. It's up to the plugin (or another plugin) to show appropriate tools on the wp-login.php page then (for example OpenID field).

    The administrator user might need to login normally in case of OpenID does not work. There could be a special URL parameter, like ?show_username_password_form=true, that could force the form visible. Anyway, it could be up to the "hiding" plugin how this is accomplished.

    Posted: 6 years ago #
  2. Jonathan Dingman

    I made my own login input fields that do a $_POST to wp-login.php and it works beautifully.

    I would give that a try.

    Posted: 6 years ago #

RSS feed for this topic


You must log in to post.

  • Rating

    0 Votes
  • Status

    This is plugin territory