All Topics
Inline post update
Hi there everyone.
I have this issue,where I have columns of Advanced Custom Fields, and on the side in function.php I have sum of one of the fields with second one. My problem is, that when I update post conditional way, I all calculate as it should, but when edit those values inline, it doesnt do fucnctions(.php) as it doesnt update post as WP does normally.
I found your way to go around it, or at least I thought i did.
https://www.admincolumns.com/documentation/guides/update-modified-date-using-inline-edit-custom-fields/
But it did not work as expect,or at all for that matter. Is there any way to update post from inline editing?
My fucntion is this:
function my_acf_save_post( $post_id ) {
// get new value
$CenaJedna = get_field('cena_1');
$CenaDve = get_field('cena_1');
// do something
$CenaCelkem = $CenaJedna + $CenaDve;
update_field('cena_soucet', $CenaCelkem, $post_id);
}
add_action('acf/save_post', 'my_acf_save_post', 20);
function my_acf_save_postt( $post_id ) {
// get new value
$CenaJedna = get_field('cena_soucet');
$CenaDve = get_field('cena_registrace');
// do something
$CenaCelkem = $CenaJedna - $CenaDve;
update_field('rozdil_cen', $CenaCelkem, $post_id);
}
add_action('acf/save_post', 'my_acf_save_postt', 20);
function my_acf_save_postit( $post_id ) {
// get new value
$CenaJedna = get_field('cena_soucet');
$CenaDve = get_field('cena_registrace');
// do something
$CenaCelkem = $CenaJedna / $CenaDve * 100;
update_field('rozdil_cen_procenta', $CenaCelkem, $post_id);
}
add_action('acf/save_post', 'my_acf_save_postit', 20);
You must be logged in to reply to this topic.