Forum Replies Created

  • were you able to resolve this?

  • Solved it. If anyone ever needs this here you go. My main issue was that instead of using $_POST[‘acf’][‘field_5da4981a6418e’] I used $_POST[‘acf’][‘phone_numbers’] so it wasn’t storing the values but storing NULL.

    function update_phone() {
      global $wpdb;
      $current_user_id = get_current_user_id();
      $new_value = $_POST['acf']['field_5da4981a6418e'];
          "phone_numbers" => $new_value,
          'wp_user' =>  $current_user_id,
        array( '%s' )
    add_action('acf/save_post', 'update_phone', 1);
  • okay so I got the values to populate using the code below

    function populate_phone($field) {
      global $wpdb; //use wp database
      $field['value'] = 'N/A'; //default value
      $current_user_id = get_current_user_id(); //get logged in user's id
      $wp_custom_user_info = $wpdb->get_results("
        SELECT * FROM custom_table 
        WHERE wp_user=" . $current_user_id
      $field['value'] = $wp_custom_user_info[0]->phone_numbers;
      return $field;
     add_filter('acf/load_field/name=phone', 'populate_phone');

    My other question still stands: How do I update that value after pressing “Save/Update” button?

Viewing 3 posts - 1 through 3 (of 3 total)