通过下面的代码,可以将WordPress默认注册页面链接重定向到自定义注册页面。
文章源自知更鸟-https://zmingcx.com/redirect-wordpress-registration-page-custom-registration-page.html文章源自知更鸟-https://zmingcx.com/redirect-wordpress-registration-page-custom-registration-page.html
将代码添加到当前主题函数模板 functions.php 中:文章源自知更鸟-https://zmingcx.com/redirect-wordpress-registration-page-custom-registration-page.html
add_filter( 'register','zm_register_url' ); function zm_register_url($link){ // 更改注册链接 return str_replace( site_url('wp-login.php?action=register', 'login' ),site_url( 'register', 'login' ),$link ); } add_filter( 'site_url', 'zm_fix_register_urls', 10, 3 ); function zm_fix_register_urls( $url, $path, $orig_scheme ){ // 替换注册链接 if ( $orig_scheme !== 'login' ) return $url; if ($path == 'wp-login.php?action=register') return site_url('register', 'login'); return $url; }
修改完的注册链接:https://zmingcx.com/register文章源自知更鸟-https://zmingcx.com/redirect-wordpress-registration-page-custom-registration-page.html
文章源自知更鸟-https://zmingcx.com/redirect-wordpress-registration-page-custom-registration-page.html 文章源自知更鸟-https://zmingcx.com/redirect-wordpress-registration-page-custom-registration-page.html

我的微信
版权声明
本站原创文章转载请注明文章出处及链接,谢谢合作!
评论