Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion, allow deleting specific cron events (using args) with wp cron delete #79

Open
1 task done
tylercollier opened this issue Dec 20, 2021 · 6 comments
Open
1 task done

Comments

@tylercollier
Copy link

Feature Request

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.

@tylercollier
Copy link
Author

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?

@schlessera
Copy link
Member

@tylercollier The 1 task done refers to the checked checkbox in the issue description:
Suggestion, allow deleting specific cron events (using args) with wp cron d  2022-01-10 at 1 15 24 PM

@tylercollier
Copy link
Author

Thanks.

Any thoughts on the feature request?

@schlessera
Copy link
Member

@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.

@tylercollier
Copy link
Author

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.

@tylercollier
Copy link
Author

Any thoughts on my previous comment? I still find myself wishing I could remove a single cron job by args. Nobody else? :-D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants