A
A
aftar2022-04-18 01:16:00
WordPress
aftar, 2022-04-18 01:16:00

Why is a 500 error returned on registration?

Goodnight! I am making my registration form, but for some reason a 500 error is returned. Please advise what is wrong. PS. enters the function

add_action('wp_ajax_nopriv_registration', 'rs_new_user_registration');

function rs_new_user_registration(){

    $userdata = [
        'user_pass'            => $_POST('password'),
        'user_login'           => $_POST('login'),
        'user_email'           => $_POST('email'),
        'first_name'           => $_POST('name'),
    ];

    $user_id = wp_insert_user( $userdata );

    // возврат
    if( ! is_wp_error( $user_id ) ){
        return true;
    }
    else {
        return $user_id->get_error_message();
    }
}


here is the request body
login: sadasd
name: nsadsajdnasdnjasd
email: [email protected]
country: adssad
password: qwe123456
password_repeat: qwe123456
type_user: Пациент
agree_rules: Cогласие на использование и обработку персональных данных
action: registration


here is the error
625c919a5f5b4305727362.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question