I would like to uncheck the account status field to be Inactive when the expiration date = current date.
Hello, it sounds simple, but it is actually rather complex. To automate a task in WordPress that runs periodically, you can use the WP Cron API:
https://developer.wordpress.org/reference/functions/wp_schedule_event/
The task you create should trigger custom code that finds all the posts with an expiration date field equal to Today and a checkbox field that is checked, then unchecks the checkbox field in all those posts.
I can show you how to get the value of a custom field using PHP, and I can show you how to uncheck a checkbox custom field in PHP. To get the value of a custom field, like the expiration date field, use the WordPress API get_post_meta:
$post_id = 12345; // the post ID
$expiry_field_slug = 'expiration-text-field-slug'; // the expiration text field slug
$expiry = get_post_meta( $post_id, 'wpcf-' . $expiry_field_slug, true ); // the value of the expiration text field
Toolset Types custom field slugs have a prefix of wpcf- in the database, so you can see I have added it to the slug in my code. If the expiration field has text like 08/17/2021, you could set up a Query Filter for that custom field and compare it to today's date in the same date format. It could get more complex if you store a full date and time, or if you need to support multiple date formats. You'll probably need to use our wpv_filter_query API to set that filter up correctly, since the date filtering options built-in to the Query Filter system are designed to work with date fields, not text fields.
https://toolset.com/documentation/user-guides/views/filtering-views-by-custom-fields/
https://toolset.com/documentation/user-guides/views/date-filters/
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query
To uncheck a checkbox field, the code depends on the field configurations. Usually checkbox fields are set to "When unchecked, don't save anything to the database" by default, since this option works best with custom search Views. To uncheck a checkbox with this default option "...don't save anything to the database" selected, you would delete the postmeta value like so:
$post_id = 12345; // the post ID
$checkbox_field_slug = 'account-status-slug';
delete_post_meta( $post_id, 'wpcf-' . $checkbox_field_slug );
So you can see it's pretty complex and involves a significant amount of custom code. Toolset Forms includes some built-in expiration features and an API for changing a custom field value from X to Y upon post expiration. This feature supports a radio field or a select field but not a checkbox, since it does not help you delete a checkbox field. It only allows you to change the field value from X to Y.
https://toolset.com/course-lesson/setting-up-automatic-post-expiration/#what-happens-when-posts-expire
https://toolset.com/documentation/programmer-reference/cred-api/#cred_post_expiration_custom_actions