4

So, here is my entire code in wp_content/plugins/my_plugin/my_plugin.php :

register_activation_hook(__FILE__, 'comunity_mails_activation'); add_action('check_mails_to_send', 'do_this_daily'); register_deactivation_hook(__FILE__, 'comunity_mails_deactivation'); function comunity_mails_activation() { wp_schedule_event(time(), 'daily', 'check_mails_to_send'); } function comunity_mails_deactivation() { wp_clear_scheduled_hook('check_mails_to_send'); } function do_this_daily() { wp_mail("[email protected]", "Automated Email", "Hell yeah it works!"); } 

When I do echo date("d-m-Y H:i:s",wp_next_scheduled('check_mails_to_send')); in the functions.php of my theme, it prints 13-02-2013 14:22:03

So I tried to do this :

do_action('ckeck_mails_to_send'); 

And my mail was sent. So I wonder, do I have to unschedule the task and schedule it again for the next day and compare the two timestamps and ... sounds silly...

I just don't understand why the mail has not been sent and why it's not scheduling it for the next day.

Thanks for reading/helping =D

2
  • 1
    Well, as I was working on an existing site which as maaaaany plugins already installed, I figured out that there was a define(DISABLE_WP_CON,true); somewhere in the code. Sorry... ^_^' Commented Feb 13, 2013 at 21:04
  • No need to be sorry, this was super helpful! :) Commented May 13, 2016 at 11:50

1 Answer 1

5

Well, as I was working on an existing site which as maaaaany plugins already installed, I figured out that there was a define(DISABLE_WP_CRON,true);

So when you seems to have the same problem than me. Do a research of define(DISABLE_WP_CRON,true); in your files.

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.