Home › Forums › General Issues › Update_field not working on post update › Reply To: Update_field not working on post update
@hube2 Thanks for responding ๐
I added the following:
$field = get_field_object('notification_record');
var_dump($field["key"]);
exit;
which gave me ‘field_57cee83c43f92’ as the key
so I updated my code here and it’s still not saving ๐
function do_something_on_save( $new_status, $old_status, $post ) {
//echo get_the_ID(); //returns 13
//exit;
//$field = get_field_object('notification_record');
//var_dump($field["key"]); //returns 'field_57cee83c43f92'
//exit;
update_field(
'field_57cee83c43f92',
'checking',
13
);
}
add_action( 'transition_post_status', 'do_something_on_save', 10, 3 );
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โre hard at work on ACF 6.1, and Beta 1 is now available ๐
— Advanced Custom Fields (@wp_acf) March 16, 2023
This release includes custom post type and taxonomy registration, an improved experience when selecting field types, PHP 8.1 and 8.2 compatibility, and more!
Letโs take a look ๐งตhttps://t.co/Y0WcAT11l4
© 2023 Advanced Custom Fields.
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.