Home › Forums › ACF PRO › Autocomplete end date when start date is selected in jquery date picker › Reply To: Autocomplete end date when start date is selected in jquery date picker
Hi,
I’m not sure if there is a better way to handle this but I would personally suggest to create a function fired on save post, and if the “end date” is empty, you can set the default date (5 days after the start date):
function custom_execute_save_post_actions($post_id, $post, $update){
// Stop WP from clearing custom fields on autosave
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
return;
if ( 'trash' != $post_status ) {
// check if your custom field is empty and set the default value here
}
}
add_action( 'save_post', 'custom_execute_save_post_actions', 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.