[wp-hackers] wp_schedule_event fires three times

Javier Arques j.arques at artvisual.net
Thu Nov 11 10:38:47 UTC 2010


Hi there,
I have created wp-cron event and it's being fired three times, this is
my code:


function generar_sitemap_foro () {

	$url = get_bloginfo('template_directory') . '/
generar_sitemap_foro.php?clave=patata';

	leer_url($url);

	$body = '<p>El sitemap ha sido regenerado a las '. date("j \d\e F \d
\e Y, H:i:s e O") . '</p>';

	send_mail('j.arques at artvisual.net', 'elembarazo', 'sitemap del foro
de elembarazo regenerado', $body , 'j.arques at artvisual.net');


}

add_action('generar_sitemap_foro_hook', 'generar_sitemap_foro');


if (!wp_next_scheduled('generar_sitemap_foro_hook'))
wp_schedule_event(time() + 64800, 'daily',
'generar_sitemap_foro_hook');


I put the code in functions.php in my theme, the function leer_url
read an url with curl.





More information about the wp-hackers mailing list