AI Assistant
Notifications
Clear all

Possible to change login link?

12 Posts
3 Users
0 Reactions
4,018 Views
(@chris-r)
Member Customer
Joined: 6 years ago
Posts: 53
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
  [#5039]

Hello, 

 

Is it possible to change the login link to trigger my login popup instead of redirecting to the WP login page?

 

Selection 006

 

Thank you,

 

-Chris



   
Quote
 Tom
(@tomson)
Famed Member Admin
Joined: 11 years ago
Posts: 4247
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Hi @chris-reilly,

Please read this support topic: https://wordpress.org/support/topic/change-link-for-login-link-text/



   
ReplyQuote
(@chris-r)
Member Customer
Joined: 6 years ago
Posts: 53
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Hi Tom,

It kinda sounds like he wants to change the filter after the login url.  How do I change the actual login url?  

For example:

From: https://www.misc-site.com/wp-login.php?redirect_to=misc-link

To: https://www.misc-site.com/register/?type=login?redirect_to=misc-link

I apologize for the noob questions btw. Lots of this stuff is way over my head, but I'm trying to figure it out and learn. 

 Thank you, 

-Chris



   
ReplyQuote
 Tom
(@tomson)
Famed Member Admin
Joined: 11 years ago
Posts: 4247
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

@chris-r

All is already explained in the topic. He what to do the same and put that code in your active theme functions.php file. Your code should be like this:

add_filter( 'login_url', 'my_login_linkchanger');
function my_login_linkchanger( $link ) {
      return home_url( '/register/?type=login&redirect_to=misc-link' );
}


   
ReplyQuote
(@chris-r)
Member Customer
Joined: 6 years ago
Posts: 53
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

@tomson

Thanks for getting back to me Tom.  What would that last line look like if I wanted it to behave like it currently does?  Like redirect to back to the page they were on before they signed in?  

 

Also, by adding this code, my normal WP login page doesn't change correct?

 

Thank you, 

 

-Chris



   
ReplyQuote
 Tom
(@tomson)
Famed Member Admin
Joined: 11 years ago
Posts: 4247
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

No, it doesn't affect your original login URL.

Use this code if you want to redirect back afther the login:

add_filter( 'login_url', 'my_login_linkchanger');
function my_login_linkchanger( $link ) {
      global $wp;
       return home_url(  '/register/?type=login&redirect_to=' . urlencode( home_url( $wp->request )  ) );
}


   
ReplyQuote
(@chris-r)
Member Customer
Joined: 6 years ago
Posts: 53
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

@tomson

 

Hi Tom, 

 

Thanks for clarifying that my original login won't change. 

 

I added the code you provided but I get redirected back to home after logging in.  Is there anyway to redirect the user back to the post they were on prior to logging in, like it did originally?

 

Thank you, 

 

-Chris

 



   
ReplyQuote
Elvina
(@elvina)
Support
Joined: 7 years ago
Posts: 1403
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

@chris-r,

We've just checked on our test website and don't find such an issue. 

It seems there is some plugin that manipulates with the redirected URL. Please deactivate the plugins one by one and check after each deactivation to find a problem maker. 

Another reason: probably the custom page created by theme or the plugin redirect it to the home page immediately and ignore the redirection code provided by us.



   
ReplyQuote
(@chris-r)
Member Customer
Joined: 6 years ago
Posts: 53
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

@elvina

 

Hi Elvina, 

 

I just googled the last part of the code that Tom gave me and I found the link below.  

 

https://codex.wordpress.org/Function_Reference/home_url

 

The original code that Tom posted didn't have the following code: . urlencode( home_url( $wp->request )  )

 

Based off of that link, that code suggests that the home_url would send the user back to the home page. 

 

Is this incorrect?

 

-Chris

 



   
ReplyQuote
(@chris-r)
Member Customer
Joined: 6 years ago
Posts: 53
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Hello Elvina, 

 

I just played with it a bit and you're right.  The code does appear to be correct.  When looking at the url after clicking the login button, it does in fact show the previous pages url, BUT, the url isn't displaying correctly. 

It appears like this:

Could this be why it's falling back to the home url?

 

Thank you,

-Chris



   
ReplyQuote
Elvina
(@elvina)
Support
Joined: 7 years ago
Posts: 1403
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

@chris-r,

This is not the issue, please don't worry about this.

 



   
ReplyQuote
(@chris-r)
Member Customer
Joined: 6 years ago
Posts: 53
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

@elvina

 

Okay will do.  I'll start disabling plugins like you've suggested and go from there.  

 

Thank you,

-Chris

 



   
ReplyQuote
Share:
Scroll to top