I have 2 registration forms, default one on /wp-login.php?action=register for "recruiter" users, other one on /wp-login.php?action=register&type=candidat for "candidates" users

My problem is that on candidate form, the form tag still has /wp-login.php?action=register as the action URL, and I want it to be /wp-login.php?action=register&type=candidat

I tried updating wp-login.php file but if I update Wordpress in the future, my code will be overwritten

I've tried other topics recommanding to use 'register_url' hook but it doesn't seem to work


You could do something like this:


add_action( 'register_form', function() {
    $get_type = filter_input( INPUT_GET, 'type', FILTER_SANITIZE_STRING );

    if ( ! $get_type ) {
<input type="hidden" name="type" value="<?php echo esc_attr( $get_type ); ?>" />

This will add the type parameter as a hidden field on the form if it is set in the GET query string.

  • 1
    Thanks, you made me realize that I already had a hidden input with the type, but wasn't using it correctly ! Sep 24 '18 at 8:42

I went a different route than the other answer, a modification of the registration URL through the site_url filter, I've tested it, and it works.

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 );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.