Not too sure how to phrase this one. I’m using a checkbox to fill a users meta field to indicate that they’re available. I’m looking for a way to automatically clear the field or change the fields value after a period of time. For example 1week from when the user checked the availability field. I’ve got the checkbox working perfectly and outputting the correct value to indicate that a users available. I’m just unsure where to start looking with regards to clearing the field automatically after a time period.
Any pointers would be greatly appreciated or advice on what it is I should be looking for.
Cheers,
^JD
I’d start by adding a hidden custom field that sets the date that gets set when the value of the chekbox is updated. You can set the value with an acf/save_post filter http://www.advancedcustomfields.com/resources/acfsave_post/ or maybe even an acf/update_value filter http://www.advancedcustomfields.com/resources/acfupdate_value/ and you can set another field with the date or date and time using update_post_meta() http://codex.wordpress.org/Function_Reference/update_post_meta.
Then I would look at learning how to set up a cron in WP https://codex.wordpress.org/Function_Reference/wp_cron
@hube2 cron job of course, cheers for the pointer.