• Hi,

    I’ve started writing my first plugin and I’m having some problems with the schedule/cron feature

    The idea is to have wordpress run a function every day, at a given time.

    The plugin has 2 php files :
    – ‘main’ file that includes the activate/install and deactive routines (which work fine) and shows a table with some logs
    – the php file that allows users to manage options. In this file, the schedule is defined :

    add_action(‘myplugin_schedule_daily’, ‘myplugin_run’);
    wp_schedule_event(strtotime(’00:05:00′), ‘daily’, myplugin_schedule_daily’);

    So far so good. The schedule is added to the cron. (I’m using wp-cron to see if the schedule is created, and that works fine)

    The myplugin_run() function (which should be triggered by cron)contains some basic code. But whatever I do, the code never seems to run (unless I run the code manually).
    I’ve obviously tried to wait until the cron kicks in, but nothing happens. And when I run the script directly from wp-cron, nothing happens either.
    When I run the function manually, it works fine… so it’s not a matter of the function code itself not working properly either.

    How can I troubleshoot this ?

    thanks

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘writing new plugin – problem with schedule’ is closed to new replies.