Support » Fixing WordPress » wp_schedule_event triggers three times

  • Hi there,

    I have created a wp-cron event the recreate my bbpress sitemap. Y scheduled daily but, dont know why, it is being fired three times, here is my code that I put into functions.php in my theme:

    function generate_sitemap () {
    	$url = get_bloginfo('template_directory') . '/generate_sitemap_forum.php';
    	$body = '<p>Sitemap regenerated at '. date("j \d\e F \d\e Y, H:i:s e O") . '</p>';
    	send_email(' ... ');
    add_action('generate_sitemap_hook', 'generate_sitemap');
    if (!wp_next_scheduled('generate_sitemap_hook')) wp_schedule_event(time() + 64800, 'daily', 'generate_sitemap_hook');

    “read_url” execute the url via curl, the execution time is around 2 mins. Im having this issue with another plugin too.

  • The topic ‘wp_schedule_event triggers three times’ is closed to new replies.