我采用了与另一个答案不同的方法,通过site\\u URL过滤器修改注册URL,我已经对其进行了测试,并且效果良好。
function my_verify_registration_type( $url, $path, $scheme, $blog_id ) {
if ( $scheme == \'login_post\' ) {
if ( strpos( $url, \'?action=register\' ) !== false && !empty( $_REQUEST[\'type\'] ) ) {
$url = esc_url( add_query_arg( \'type\', sanitize_text_field( $_REQUEST[\'type\'] ), $url ) );
}
}
return $url;
}
add_filter( \'site_url\', \'my_verify_registration_type\', 10, 4 );