Would it be possible to remove both the login and password fields from the login/registration form?

I'm currently trying to implement logging in/registration for my users using this plugin: https://wordpress.org/plugins/oa-social-login/

It allows them to login/register with an account from a few different websites.

If possible I'd like to keep the standard login for admins and staff so they don't have to use their social accounts, which in the event that they might be compromised, could end up locking them out of the backend, unable to perform maintenance tasks, etc.

Your best bet would be to hook register_form. It will require parsing the html and removing elements manually, something like this should point you in the right direction.

function removeFormElements(){
    $form = ob_get_contents();
    //manipulate $form to remove the elements with something like either regex or the php DOM parser
    ob_get_clean()
    echo $form;
}
add_action('register_form', 'removeFormElements');

I believe your oAuth plugin is probably handling what needs to be done in the registration_errors hook to allow a registration without a username/password, but if it isn't you would also need a function to prevent an error from being thrown due to a lack of required input.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.