$get_meta = get_post_meta('32', "payment_options", true);
print_r($get_meta);
echo "<br>";
if(update_post_meta('32','acf-field_609ec6987bb8d',$get_meta)){
echo "Success";
}
else{
echo "FAIL";
}
This again dint work :/
Exactly! We are just trying to resave already saved values so they also get stored in the database. So what function shall we use here?
Hello,
I tried the following code –
$get_meta = get_post_meta('32', "payment_options", true);
print_r($get_meta);
echo "<br>";
if(update_field('payment_options', $get_meta, '32')){
echo "Success";
}
else{
echo "FAIL";
}
And the output is –
Array ( [0] => paypal [1] => credit-card [2] => stripe )
FAIL
🙁
serialized array
Hello,
Thank you for your response.
I tested the code on debug page and it successfully update the normal text field value. But this field which I am updating here is checkboxes.
So the output of get_meta_data is a format like checked_val1 | checked_val2 | ..
How do I use update_field on such data and update checked boxes??
Thanks!
Hello,
I tried the following code but it dint work out.
function perform_save_post($post_id , $form_id){
if($form_id == "195"){
$get_meta = get_post_meta($post_id, "acf-field_609ec6987bb8d");
update_field('acf-field_609ec6987bb8d', $get_meta, $post_id);
}
}
add_action( 'wpuf_add_post_after_insert', 'perform_save_post',10, 2 );
add_action( 'wpuf_edit_post_after_update', 'perform_save_post',10,2 );
Where did I go wrong?
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.