• Im trying to get the next run time of a Wp-Control created PHP cron job using wp_next_scheduled function but it is always returning false. I was using wp_next_scheduled(‘crontrol_cron_job’, $args) but maybe the hook is wrong? Any suggestion on how to retrieve this regarding a specific php cron job? Not sure if you have a function in your plugin i can tap into?

    Thanks in advance

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    The $args array needs to match exactly in order for WordPress to find it. Internally the PHP code is stored in the code element of the args. So I think your $args array needs to look like this:

    $args = array( 'code' => $code );

    where $code is the PHP exactly as you entered it.

    Let me know how you get on.

    Thread Starter C-Fusion Multimedia

    (@cfusionmm)

    Tested the following and still getting nothing on the results, do i need to include any php tags in $code?

    $code = 'CronProcessMergeRequestQueue();';
                            $args = array( 'code' => $code );
                            $cronInfo = wp_next_scheduled('crontrol_cron_job', $args);
    var_dump($cronInfo);
    Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    I’m not sure in that case then, sorry. You don’t need PHP tags, no.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Get Next Run Time on PHP Cron Event’ is closed to new replies.