6

I want to remove all the links from my network login page ("Register","Lost your password" and "Back to site") how can i do that?

enter image description here

4 Answers 4

7

I am not sure there is a way to suppress all these links, but you can hide them with CSS:

add_action( 'login_head', 'hide_login_nav' );

function hide_login_nav()
{
    ?><style>#nav,#backtoblog{display:none}</style><?php
}

Result:

enter image description here

5
  • Was typing out this answer when you posted it. This is the only way I've been able to do it reliably. Commented May 10, 2013 at 17:24
  • @AndrewBartel Type faster! :P
    – fuxia
    Commented May 10, 2013 at 17:25
  • Twice in two days I've been beaten to the punch! You'd think ~80 wpm would be enough. Commented May 10, 2013 at 17:25
  • and how could I just change the text on this link? I don't wan to hide, but display another text... Commented Sep 29, 2014 at 16:20
  • @vinigarcia87 Please ask a new question.
    – fuxia
    Commented Sep 29, 2014 at 19:48
1

Ten years later, people still search for this (I know, because that is how I landed here), and the answer seems to always be: use CSS or install a plugin.

The CSS is merely hiding the info from view. If you don't want the HTML to render all together for it, you need to apply some filters. Add the following to your functions.php file:

if ( ! function_exists( my_theme_login_filters ) ) :
function my_theme_login_filters() {
 add_filter( 'login_site_html_link' , 'set_login_backtohtml' ); //This is for the "Go back to Your Blog" link
 add_filter( 'register' , 'set_login_registerhtml' ); //For the register link
 add_filter( 'lost_password_html_link' , 'set_login_lostpasswordhtml' ); //For the Lost Password link
 
//Repeat this function for each of the elements you want to suppress, OR
//just change the names above to the same thing.
 function set_login_backtohtml( $url ) {
   $url = '';
   return $url;
 }
endif;

Sorry, I suck at code notations. Basically, the 'add_filter' lines call up each aspect of the login page you want to suppress or change (that's the first parameter), followed by the value with which you want to replace it. You can either insert a variable here, or call up a function.

For this example, I went with the function way to demonstrate the flexibility. You can add the HTML of your choice in the $url variable. One thing to note, however, is that the "Back To" block will only suppress the <a> tag; wp-login produces the <p class="backtoblog"> code outside of any filters that I could see. So, if in 'set_login_backtohtml' you set $url = "Inconceivable!";, then the resulting HTML would look something like:

<p class="backtoblog">
 Inconceivable!
</p>

The Lost Password and Register links, similarly, are wrapped inside a <p> tag with a class of 'nav.'

What you can do is open up the wp-login.php (or any core) file and look at all the lines that call apply_filter. Each one of these is something you can change in your functions.php file with the add_filter() methods. DO NOT CHANGE THE CORE FILE ITSELF! Just make sure you study the filter you want to manipulate carefully.

Hope this helps!

0

If you are customizing your login page, there are also great plugins that help you do that and more. One I recall working great is LoginPress.

https://wordpress.org/plugins/loginpress/

-1

just go to htdocs->then ur site->wp-login.php page and find function login_footer($input_id = '') {

    comment this line //printf( _x( '&larr; Back to %s', 'site' ), get_bloginfo( 'title', 'display' ) );

and if want to hide all the URL's just comment the whole function

1
  • 4
    You should never modify WordPress core files. Not only will your changes will be lost after an upgrade, but it's just bad practice. Commented Feb 17, 2017 at 19:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.