Skip to content

Instantly share code, notes, and snippets.

@gene1wood
Last active October 30, 2023 00:14
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save gene1wood/f3d39a8f894973cc8d75e2a632ec3715 to your computer and use it in GitHub Desktop.
Save gene1wood/f3d39a8f894973cc8d75e2a632ec3715 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