0

I am using acf_form() for user login process. I am doing login process using Ajax and everything is done inside wordpress’ ajax callback function.

so I inserted a hidden field inside the form by acf/input/form_data action hook:

add_action('acf/input/form_data', 'shp_ajax_acf_login_input',100,1);
function shp_ajax_acf_login_input($args){
    if(is_admin() || (isset($args['post_id']) && $args['post_id'] != 'shp_ajax_acf_login'))
    return;

    echo '<input type="hidden" name="action" value="shp_ajax_acf_login_ajax_submit" />';
    echo '<input type="hidden" name="test_name" value="test_value" />';
}

when I check the DOM using inspect element, both hidden fields exist inside the form. but when I press the login button I expect the $_POST data include action: shp_ajax_login_ajax_func but this value is replaced by acf’s defult "action: acf/validate_save_post" when data is sending.

How can I send my own action value in current case.

Thanks in advance.

Your Answer

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

Browse other questions tagged or ask your own question.