Suggestion, allow deleting specific cron events (using args) with wp cron delete
tylercollier opened this issue · 6 comments
Feature Request
- Yes, I reviewed the contribution guidelines.
Describe your use case and the problem you are facing
I'd like to be able to delete specific cron events, including args, not just all events for a given hook name.
Let's say I have two cron events:
Hook name | Args |
---|---|
process_stuff_for_user | [123] |
process_stuff_for_user | [456] |
Right now, if I do wp cron event delete process_stuff_for_user
, it deletes all events with that hook name.
Describe the solution you'd like
Allow me to delete a specific one with e.g.
$ wp cron event delete process_stuff_for_user [123]
I suppose the args would need to be supplied as a JSON string.
Github shows "1 task done" on this issue, although I don't see a list of tasks. May I ask if that means someone is working on something related to this?
@tylercollier The 1 task done
refers to the checked checkbox in the issue description:
Thanks.
Any thoughts on the feature request?
@tylercollier Yes, I think this could be useful. However, it might not be possible for some arguments to be provided via the CLI. For simple scalars, or even arrays through JSON, this would work, though.
I hear ya. You're right. How about a serialized PHP value? Those are pretty awkward to create by hand, but still worth it. I'd probably just go to some website that generates serialized PHP from JSON. Or I'd keep some example value around to copy and paste and alter as appropriate.
Or, allow a --input-format=json
or input-format=php
parameter? Perhaps default to JSON. Allowing JSON makes it more ergonomic for the user, and allowing the php serialization format puts the power in the user's hands, if he's willing to do generate the data somehow.
Any thoughts on my previous comment? I still find myself wishing I could remove a single cron job by args. Nobody else? :-D