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 11 Answer
Reset to default 0Assuming 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
版权声明:本文标题:Leave login URL for my user beautiful 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736653801a1946204.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论