WordPress.org

Ready to get started?Download WordPress

Forums

Crons not working (5 posts)

  1. rajasekharan
    Member
    Posted 5 years ago #

    Hi,

    I am trying to get wordpress to call a function called "wpr_cronjob" every hour in my plugin. So I registered a activation hook and in the book I call the following function:

    wp_schedule_event(time(), 'hourly', 'wpr_cronjob');

    The function is not getting called because every time the function is called, I will receive an email (which I am not). I have set up a cronjob on my linux server to run wp-cron.php every 5 minutes and the function is still not getting called. Could you please tell me what I am doing wrong?

    Thanks in advacne,

    Raj

  2. BlaM4c
    Member
    Posted 4 years ago #

    I have the same problem here, both with a plugin that I have written myself and another plugin. If I schedule posts, that works great. Just "plugin crons" don't seem to be called at all.

    Is there any way I can find out why?

    Is there a CRON Log?

  3. lordcoste
    Member
    Posted 4 years ago #

    I have the same problem in one of my plugin :/

  4. rajasekharan
    Member
    Posted 4 years ago #

    I email the mailing list and then found out the solution as follows:

    First add the function to be called to a action

    add_action('some_action','my_function');

    some_action can be replaced with any random name for an action you can think of.

    Then schedule the action:

    wp_schedule_event(time(), 'hourly', 'some_action');

    The key is to schedule actions not functions.

  5. rajasekharan
    Member
    Posted 4 years ago #

    Further more the core-control plugin can be used to see the currently scheduled crons.

Topic Closed

This topic has been closed to new replies.

About this Topic