• I have a cronjob being run using the wp_shedule_single_event().

    As part of the args for that event, I have a timestamp. That timestamp is not stored anywhere except in that cronjob (it passes the timestamp to another function).

    I would like to be able to clear that event with the wp_clear_scheduled_hook().

    But, like I said, I don’t currently store the earlier timestamp anywhere.

    My question: Can I retrieve part of a cronjob.

    Say I have wp_get_schedule ($hook, 3 args); What if I supply 2 of the args that make it unique, can I get the 3rd (timestamp) arg in any way? Or maybe just a regex? Pass the 1st to, and make the 3rd just match a regex.

    Basically I want to match wp_get_schedule, but match using a portion of the arguments section.

    Yes, I know I could store the timestamp in the database for the times I need it later. But I would prefer to not add another call to the database if possible. I’d like something like mentioned above. If that really is not doable, I’ll go the database route.

    But I thought I’d see if its possible to retrieve variables from the cronjob first.

    (I should say, the timestamp I’m passing is NOT the same as the timestamp for the cronjob to run. That could be confusing to some. It’s a separate timestamp I’m using in an entirely different function that is called by the cronjob)

  • The topic ‘Getting arguments from a CronJob’ is closed to new replies.