Closed ghost closed 2 years ago
Heya, that's a good question. I think you're absolutely right and it's a feature that wouldn't be too hard to implement. Would you expect that enabled by default or as an option?
I'd expect it to be enabled whenever build trigger after post update is enabled - I'd assume the moving post to trash should be treated as an update.
I can try to make a pull request (unless you are proficient in WordPress and you want it yourself, I somewhat tinker with WordPress, but I don't know PHP). I think we should run it only when we delete a post that is already published.
I wonder which action should we use, is it wp_trash_post
or trashed_post
? In the first one we'll have access to post status, but it seems it's too early to call it then, trashed_post
action is certainly a good time to trigger a build, but we don't have access to post status (it'll be always trash
at this point), so we'd have to call it regardless the trashed post status was publish
, draft
or future
. Am I missing something here?
On the other hand we're not checking post status in post_updated
, so maybe it won't hurt to use trashed_post
hook anyway?
true, maybe something we should do. but honestly for now trashed_post
seems fine. I'm not completely sure if bulk deleting posts would cause multiple deploys.
I'm totally open to a PR, I have no idea what I'm doing 👍
Hi,
I noticed no build is being triggered when the post is being moved to trash. It seems to be reasonable to trigger a build in such situation, at least when an already published post is being removed, doesn't it?
Otherwise I think it's a nice plugin, I'm trying to build a Next.js application with WordPress backend ;)