publishpress / PublishPress-Future

This plugin was known as "Post Expirator", and now it is called "PublishPress Future".
https://wordpress.org/plugins/post-expirator/
7 stars 11 forks source link

Zombie auto-drafts appear after a week when Auto-enable is turned on for CPT #1024

Closed martondarvas closed 1 week ago

martondarvas commented 1 week ago

When Auto-enable is turned on for a CPT, it seems that PublishPress Future immediately schedules an action (turn to private in 1 week) for the auto-draft, which it remembers and executes even after the auto-draft has long been automatically discarded. This means that a new post with the name "auto-draft" is actually created, just so that it then could be set to private (so it's basically a zombie auto-draft). I haven't tested it with normal post types, but I think the same problem could come up with pages and posts as well.

We noticed auto-drafts appearing even when we were not logged in, and then I realized that it always happened exactly a week later than when we originally started working on a new post. I checked the scheduled actions list, and I've found some scheduled actions like this for auto-drafts in the list.

For now, I turned off auto-enable, but I think it's still possible that an auto-draft version of an edited post is going to be recreated if the future action is enabled at the time of the auto save.

If you can somehow prevent actions to be scheduled for auto-drafts and autosaves, it would solve this problem (I can't think of any use-case when someone would actually need this functionality).

Thank you in advance for looking into this problem.