admin管理员组

文章数量:1125084

Good afternoon, I've been here for a long time trying to keep my website's login URL as example: www.meusite.br/entrar, but the URL presented to my user when he clicks on the login button appears: www.meusite. br/entrar/?redirect_to=https%3A%2F%2Fradiomandeladigital.br

Detail the registration URL is perfectly fine

See that the register URL is correct, pretty short, but the login URL is ridiculously horrible

Good afternoon, I've been here for a long time trying to keep my website's login URL as example: www.meusite.com.br/entrar, but the URL presented to my user when he clicks on the login button appears: www.meusite.com. br/entrar/?redirect_to=https%3A%2F%2Fradiomandeladigital.com.br

Detail the registration URL is perfectly fine

See that the register URL is correct, pretty short, but the login URL is ridiculously horrible

Share Improve this question asked Feb 12, 2024 at 16:28 Wesley RodrigoWesley Rodrigo 1
Add a comment  | 

1 Answer 1

Reset to default 0

Assuming you're trying to get rid of the ?redirect_to={url}, you can use the login_url filter to change the login URL, and remove unwanted querystring components with remove_query_arg():

add_filter( 'login_url', 'wpse422493_strip_login_url' );
/**
 * Strips `redirect_to` from the querystring.
 *
 * @param  string $url The login URL.
 * @return string      The filtered login URL.
 */
function wpse422493_strip_login_url( $url ) {
    return remove_query_arg( 'redirect_to', $url );
}

Note: This code is untested and intended as a starting point only, not as finished, production-ready code. Make sure you test it in a non-production environment before you use it in production.

本文标签: Leave login URL for my user beautiful