Simple registration form

By default registration form is full registration. In some cases, you may want to keep the form simple. This code snippet will allow you to keep only the fields you want.

If you do not know how to add snippets properly, take a look at ourĀ documentation file, where we explained how you can do this.

 

add_filter( "wpjr_form_init_register", "my_wpjr_form_init_register" );
function my_wpjr_form_init_register( $form ) {

    $fields_to_hide = array( "field_name_1", "field_name_2" );

    foreach( $fields_to_hide as $field_name ) {

        if( $form->hasElement( $field_name ) ) {
            $form->removeElement( $field_name );
        }
    }

    // If you do not want to remove education and/or experience sections, please remove those two lines
    $form->removeGroup( "education" );
    $form->removeGroup( "experience" );

    return $form;
}

In the above example, we added just 2 example field names, but you need to fill those array like this, with the name of all fields that you want to hide.

If you want to do the same thing for your employer, you can use this code:

add_filter( "wpjb_form_init_register", "my_wpjb_form_init_register" );
function my_wpjb_form_init_register( $form ) {
    $fields_to_hide = array( "field_name_1", "field_name_2" );

    foreach( $fields_to_hide as $field_name ) {
        if( $form->hasElement( $field_name ) ) {
            $form->removeElement( $field_name ); 
        } 
    }

    return $form; 
}

 

Leave a Reply

Your email address will not be published.