Using update_field() on post status transition?
-
I want to modify an ACF field when the post status changes to my custom post status called “Order Assigned”.
I have verified that I’m using the correct field key, the function is running, and the IF statement is evaluating to true. However, the field is not updating, or perhaps it’s getting overwritten by something else.
function ls_add_to_calendar($new_status, $old_status, $post) { if( $new_status != $old_status && $new_status == 'order-assigned' ) { update_field('field_561e9cbfdd5e6', '123', $post->id); } } add_action( 'transition_post_status', 'ls_add_to_calendar', 10, 3 );
Any ideas as to why it’s not working? Thanks.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Using update_field() on post status transition?’ is closed to new replies.