acp/editing/saved – how to get it work
Hi Stefan, I am sorry to bother with this again.
I am trying to get the funcions work after inline editing,but with no luck at all.
I went to Documentation on acp/editing/saved, that should run after value is stored in column.
I took the last example, because you mention there it will run custom method. All I need is sum of two columns to calculate, one of which i already have and second one is user inputed in Inline Edit.
So my current code looks like this:
function my_acp_after_ajax_column_save_update_custom_field_value( $column, $id, $value ) {
// Check for a custom field column
if ( ! $column instanceof AC_Column_Meta ) {
return;
}
$custom_field = 'my_custom_field';
$post_type = 'post';
if ( $post_type === $column->get_post_type() && $custom_field === $column->get_meta_key() ) {
// Trigger a custom method.
$CenaJedna = get_field('cena_soucet');
$CenaDve = get_field('cena_registrace');
$CenaCelkem = $CenaJedna - $CenaDve;
update_field('rozdil_cen', $CenaCelkem, $post_id);
}
}
add_action( 'acp/editing/saved', 'my_acp_after_ajax_column_save_update_custom_field_value', 10, 2 );
I am not php savvy, I can barely translate what those few lines should do, but as for the sum funcion, this one works when post is updated classic way. Should be ok then,by definition.
Now with this code, when I change said column (cena_registrace), all I get is unending buffering. (https://i.imgur.com/VvMXWgc.png)
What am I doing wrong? Thank you in advance for your help.
You must be logged in to reply to this topic.