No, the new row doesn’t show and there’s is no new entry in the wp_postmeta table for that post_id. I’ve even tried to simplify the code by using add_row and the effect is the same:
$row = array(
'date' => date('F j, Y g:i a'),
'action' => 'Status changed '.$old.' to '.$new
);
$new_row_count = add_row( 'history', $row, $post->ID );
The above fails to add the new row (and no new entry in the database) whereas:
$row = array(
'date' => date('F j, Y g:i a'),
'action' => 'Status changed '.$old.' to '.$new
);
$new_row_count = add_row( 'history', $row, $post->ID );
var_dump( $new_row_count );
exit;
does add the new entry as expected (and is added ok to the wp_postmeta table) and the $new_row_count is as expected.
I’ll continue to debug by stepping into the ACF core and adding die() points to see if I can pin down exactly where it’s going wrong.
*Update* I think this is all down to me trying to add a new repeater row when the post status changes and WordPress does that in an Ajax request. I think the simplest solution is just to maintain a separate ACF ‘Status’ field which will also have the benefit of allowing me more statuses 😉