The login_site_html_link WordPress PHP Filter allows you to modify the “Go to site” link displayed in the login page footer.
Usage
add_filter('login_site_html_link', 'your_custom_function');
function your_custom_function($link) {
// your custom code here
return $link;
}
Parameters
$link(string): HTML link to the home URL of the current site.
More information
See WordPress Developer Resources: login_site_html_link
Examples
Change the “Go to site” link text
Change the “Go to site” link text to “Return to Homepage”.
add_filter('login_site_html_link', 'change_site_link_text');
function change_site_link_text($link) {
$link = str_replace('Go to site', 'Return to Homepage', $link);
return $link;
}
Add a custom CSS class to the “Go to site” link
Add a custom CSS class custom-link to the “Go to site” link.
add_filter('login_site_html_link', 'add_custom_css_class');
function add_custom_css_class($link) {
$link = str_replace('<a ', '<a class="custom-link" ', $link);
return $link;
}
Open the “Go to site” link in a new tab
Make the “Go to site” link open in a new browser tab.
add_filter('login_site_html_link', 'open_link_in_new_tab');
function open_link_in_new_tab($link) {
$link = str_replace('<a ', '<a target="_blank" ', $link);
return $link;
}
Change the “Go to site” link URL
Change the “Go to site” link URL to a custom URL, such as https://example.com/custom-page.
add_filter('login_site_html_link', 'change_site_link_url');
function change_site_link_url($link) {
$new_url = 'https://example.com/custom-page';
$link = preg_replace('/href="[^"]+"/', 'href="' . $new_url . '"', $link);
return $link;
}
Remove the “Go to site” link
Remove the “Go to site” link from the login page footer.
add_filter('login_site_html_link', 'remove_site_link');
function remove_site_link($link) {
return '';
}