Skip to content

Instantly share code, notes, and snippets.

@kagg-design
Last active June 11, 2022 08:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kagg-design/ec75b2056ba4a3ed776f6c8ec55af414 to your computer and use it in GitHub Desktop.
Save kagg-design/ec75b2056ba4a3ed776f6c8ec55af414 to your computer and use it in GitHub Desktop.
Open login page by Ctrl+Alt+L. Can be used as a mu-plugin.
<?php
/**
* Add shortcuts.
*
* @return void
*/
function kagg_shortcuts() {
?>
<script>
window.addEventListener( 'keydown', function( event ) {
if ( event.ctrlKey && event.altKey && event.code === 'KeyL' ) {
window.location.href = '/wp-login.php';
}
} );
</script>
<?php
}
add_action( 'wp_print_footer_scripts', 'kagg_shortcuts' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment