Support

Account

Home Forums General Issues Hidden input's value is overrided by acf

Unread

Hidden input's value is overrided by acf

  • Hello everyone,

    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 see the form 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.

Viewing 1 post (of 1 total)

The topic ‘Hidden input's value is overrided by acf’ is closed to new replies.