Hello everyone,
I have noticed that the cron section on our website is not working. I mean the crons are executing but the respective actions associated with it were not called. For this reason, our abandoned cart plugin was also not sending mails to the respective people.
I wrote a plugin to fetch reviews on a daily basis from a 3rd party website. A gist of the code is as follows:
register_activation_hook(__FILE__, 'my_plugin_activation');
register_deactivation_hook(__FILE__, 'my_plugin_deactivation');
function my_plugin_activation() {
if (! wp_next_scheduled ( 'my_daily_fetch_review_cron' )) {
wp_schedule_event(time(), 'daily', 'my_daily_fetch_review_cron');
}
}
add_action('my_daily_fetch_review_cron', array('My_Review_Class','my_static_fetch_rating'));
Please ignore the function names or the nomenclature used. It is just a demo code to explain my point.
Now, the action should be called at the time the plugin is activated and then from that point onwards, on a daily basis.
This works perfectly on my local setup but does not run on the production server I spent a lot of time to understand why this might be happening. Even disabled wordpress wp_cron and enabled server cron. From server cron, am pinging the wp-cron.php every 10 minutes.
Any guidance would be really appreciate. Any pointers to where I might look to debug this ?
Thank you in advance. You guys are awesome as usual
Sumeet Chawla