Skip to content

Instantly share code, notes, and snippets.

@yudapc
Forked from gene1wood/disable-native-login.php
Created November 9, 2022 02:01
Show Gist options
  • Save yudapc/e765e39020b36f75cd2ed3054f32467d to your computer and use it in GitHub Desktop.
Save yudapc/e765e39020b36f75cd2ed3054f32467d to your computer and use it in GitHub Desktop.
Disable Wordpress native username password login when using Google Apps Login
<?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