// Script to hide login and password recovery links from search engines
document.addEventListener("DOMContentLoaded", function() {
// Select the login link
var loginLink = document.querySelector('a[href*="wp-login.php"]');
if (loginLink) {
// Change the href attribute to a JavaScript function
loginLink.setAttribute('href', 'javascript:void(0);');
// Add an event listener to handle the click event
loginLink.addEventListener('click', function() {
window.location.href = '/wp-login.php';
});
}
// Select the lost password link
var lostPasswordLink = document.querySelector('a[href*="wp-login.php?action=lostpassword"]');
if (lostPasswordLink) {
// Change the href attribute to a JavaScript function
lostPasswordLink.setAttribute('href', 'javascript:void(0);');
// Add an event listener to handle the click event
lostPasswordLink.addEventListener('click', function() {
window.location.href = '/wp-login.php?action=lostpassword';
});
}
});