-
-
Save yudapc/e765e39020b36f75cd2ed3054f32467d to your computer and use it in GitHub Desktop.
Disable Wordpress native username password login when using Google Apps Login
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Disable Native Login | |
* Plugin URI: https://cs.cementhorizon.com/ | |
* Description: Disable the native username password login in wordpress | |
* Version: 1.0.0 | |
* Author: Gene Wood | |
* Author URI: https://cs.cementhorizon.com/ | |
* License: GPL2 | |
*/ | |
// Install this by putting it in wp-content/plugins/disable-native-login/ | |
// https://deluxeblogtips.com/completely-disable-login-username-password-wordpress/ | |
add_action( 'login_init', function () { | |
if ( isset( $_POST['log'] ) || isset( $_POST['user_login'] ) ) { | |
die; | |
} | |
} ); | |
// https://codex.wordpress.org/Customizing_the_Login_Form | |
function hide_login_form() { ?> | |
<style type="text/css"> | |
#loginform h3.galogin-or, #loginform p:not(.galogin), #loginform div.user-pass-wrap, #login p#nav { | |
display: none; | |
} | |
</style> | |
<?php } | |
add_action( 'login_enqueue_scripts', 'hide_login_form' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment