Support

Account

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);