Home › Forums › General Issues › Populating custom Input Field values from custom database values › Reply To: Populating custom Input Field values from custom database values
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'];
$wpdb->update(
"custom_table",
array(
"phone_numbers" => $new_value,
),
array(
'wp_user' => $current_user_id,
),
array(
'%s',
),
array( '%s' )
);
}
add_action('acf/save_post', 'update_phone', 1);
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.