The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

writing new plugin - problem with schedule (3 posts)

  1. peterve
    Posted 7 years ago #


    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 ?


  2. letsfx
    Posted 6 years ago #

    Same problem with me!
    Have you got any solution yet?

  3. lordcoste
    Posted 6 years ago #

    I have the same problem

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.