Home › Forums › Front-end Issues › Get a field value before Save › Reply To: Get a field value before Save
it was easy in fact, even if getting field value is easier after the save of the post 🙂
function argu19_set_ending_date_if_empty( $post_id ) {
if ( !isset($_POST['acf']['field_5bd0266e9f955']) ) :
$value = get_field('event_startingdate');
update_field('event_endingdate', $value);
endif;
}
// Apply to all fields.
add_filter('acf/save_post', 'argu19_set_ending_date_if_empty', 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 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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.