Support

Account

Home Forums ACF PRO Front end post update post meta Reply To: Front end post update post meta

  • Have you actually tried to dump $_POST ? You then would have seen the contents and would have seen that $_POST[‘selected_model’] does not exist.

    To retrieve a posted value, you need to look into $_POST[ ‘acf’ ]. In it you will find the field keys (not the names).

    So you need to check what the field key is for your field.

    Then do something like this:

    if ( ! empty( $_POST[ 'acf' ][ 'field_5a0de683a21cf' ] ) {
        update_post_meta($post_id, 'car_model', 'field_key' );
    }