{"id":16945135,"date":"2023-08-03T16:26:10","date_gmt":"2023-08-03T16:26:10","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/cron-event-does-not-get-cleared-when-date-is-deleted\/"},"modified":"2023-08-03T16:26:10","modified_gmt":"2023-08-03T16:26:10","slug":"cron-event-does-not-get-cleared-when-date-is-deleted","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/cron-event-does-not-get-cleared-when-date-is-deleted\/","title":{"rendered":"Cron event does not get cleared when date is deleted"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hello! <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On saving a product, there is logic to clear any existing one-time event and re-schedule it with the new date, but if the new expiry date is just an empty string (i.e., no more expiry, it&#8217;s been removed), then the old event is not cleared: <a href=\"https:\/\/d.pr\/i\/7ZukCj\">Markup 2023-08-03 at 13.45.21.png &#8211; Droplr<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Steps to reproduce:<\/p>\n\n\n\n<ol>\n<li>Create a new product<\/li>\n\n\n\n<li>Set the expiration date to tomorrow &amp; save the product<\/li>\n\n\n\n<li>Remove the expiration date, i.e. leave the setting field empty, &amp; save the product<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Expected: the one-time cron event is removed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Actual: the one-time cron event will run tomorrow.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8212;-<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Current workaround: for now, it works to set the <code>Action<\/code> field to <code>None<\/code>, but if somebody forgets to do that, then the action will take place on the date that was previously set.<\/p>\n","protected":false},"template":"","class_list":["post-16945135","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/16945135","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/16945135\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=16945135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}