0

Might be a bad question but im unable to solve it right now.

My WP_cron executes on the starting point but doesn't seem to perform afterwards.

My functions.php code is:

 add_action( 'my_scheduled_event', 'prefix_my_scheduled_event' );

 if(!wp_next_scheduled('my_scheduled_event')){
   $timestamp = strtotime( '2017-09-28 12:05:00' ); 
   $recurrence = 'twicedaily';
   $hook = 'my_scheduled_event';
   wp_schedule_event( $timestamp, $recurrence, $hook );
 }

Additionaly i have added this line to wp-config.php to make it work in the first place.

 define('ALTERNATE_WP_CRON', true);

Any suggestions are welcome.

2
  • Despite its name, wp_cron doesn't operate exactly like cron on a server. It only gets triggered if and when someone visits the website. Is it possible that it wasn't triggered because there were no visits? Commented Sep 29, 2017 at 10:45
  • no im afraid in the time in question i had over 900 page views Commented Sep 29, 2017 at 11:05

1 Answer 1

-1

This can happen if your server is overloaded on a shared host. Check your server logs or resource use in c-panel. It can also be limited by your host depending on the server configuration.

1
  • Dedicated hosting in place no limits at all in place as all managed by ourselves. Commented Sep 29, 2017 at 17:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.