Last active
November 3, 2023 15:31
-
-
Save mustafauysal/b84ced33737a399bda4bb742113bc851 to your computer and use it in GitHub Desktop.
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 | |
add_action( 'wp_footer', 'magic_login_auto_fill_email_from_url' ); | |
add_action( 'login_footer', 'magic_login_auto_fill_email_from_url' ); | |
function magic_login_auto_fill_email_from_url() { | |
?> | |
<script> | |
// Function to get URL parameters | |
function getURLParameter(name) { | |
const urlParams = new URLSearchParams(window.location.search); | |
return urlParams.get(name); | |
} | |
// Get the email parameter from the URL | |
const email = getURLParameter('email'); | |
// If the email parameter exists, populate the input field named "log" | |
if (email) { | |
const logInput = document.querySelector('input[name="log"]'); | |
if (logInput) { | |
logInput.value = email; | |
} | |
} | |
</script> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
for auto form submit