Title: Cron rescheduling error
Last modified: August 22, 2024

---

# Cron rescheduling error

 *  Resolved [danbeach](https://wordpress.org/support/users/danbeach/)
 * (@danbeach)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/cron-rescheduling-error/)
 * Recently, we’ve been getting a lot (every 5 seconds or so)of PHP errors related
   to NS-Cloner. They all look like:
 * `Cron reschedule event error for hook: ns_cloner_cron, Error code: invalid_schedule,
   Error message: Event schedule does not exist., Data: {"schedule":"ns_cloner_cron_interval","
   args":[],"interval":120}`
 * I’m not exactly sure when they started, by guess is in the last couple of weeks,
   since either the 4.4.6 or 4.4.7 update. Is there something we can do to get rid
   of these?

Viewing 13 replies - 1 through 13 (of 13 total)

 *  Plugin Author [Never Settle](https://wordpress.org/support/users/neversettle/)
 * (@neversettle)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/cron-rescheduling-error/#post-17969806)
 * Hello [@danbeach](https://wordpress.org/support/users/danbeach/)
 * The latest release that went out yesterday should not have the php notice. Please
   confirm
 *  Thread Starter [danbeach](https://wordpress.org/support/users/danbeach/)
 * (@danbeach)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/cron-rescheduling-error/#post-17970137)
 * We are running the latest version (4.4.7) and continue to see the php errors.
 *  [jdarbuckle](https://wordpress.org/support/users/jdarbuckle/)
 * (@jdarbuckle)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/cron-rescheduling-error/#post-17972038)
 * Following for updates, thanks.
 *  [Kim Hornung](https://wordpress.org/support/users/keepmovingdk/)
 * (@keepmovingdk)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/cron-rescheduling-error/#post-17977526)
 * I’m also seeing this warning in the debug.log file after upgrading to the most
   recent NS Cloner version and WP 6.6.1.
 * It seems that the NS Cloner’s register_interval() hook is not active when wp-
   cron.php calls wp_reschedule_event()
 *  Plugin Author [Never Settle](https://wordpress.org/support/users/neversettle/)
 * (@neversettle)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/cron-rescheduling-error/#post-17978382)
 * Hello,
 * We have pushed version 4.4.7.1 that fixes this issue. Thank you for your patience
   on this
 *  [Kim Hornung](https://wordpress.org/support/users/keepmovingdk/)
 * (@keepmovingdk)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/cron-rescheduling-error/#post-17979587)
 * Sounds great!
 * But according to my testing, this unfortunately doesn’t fix the issue. I still
   see the warnings in my debug.log file after installing v4.4.7.1 when the background
   cron jobs are running.
 * It seems that the an extra check for **wp_doing_cron()** should be added to the**
   $should_load** variable in the **__construct()** method of the** NS_Cloner** 
   class.
 * If I manually add such a check, then I no longer see the warnings.
 *  Plugin Author [Never Settle](https://wordpress.org/support/users/neversettle/)
 * (@neversettle)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/cron-rescheduling-error/#post-17979655)
 * Hello [@keepmovingdk](https://wordpress.org/support/users/keepmovingdk/)
 * Which PHP version are you using? I have tested with PHP version from 7.x to 8.2
   and there are no notices.
 *  [Kim Hornung](https://wordpress.org/support/users/keepmovingdk/)
 * (@keepmovingdk)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/cron-rescheduling-error/#post-17979850)
 * The problem is not related to PHP version (I’m on PHP 8.2).
 * The problem happens if using the built-in WP cron. You can manually trigger this
   by accessing this URL:
   [http://<hostname>/wp-cron.php?doing_wp_cron](http://<hostname>/wp-cron.php?doing_wp_cron)
 * Then you should (hopefully) see the warning in the debug.log file. But let me
   know if you don’t, then I’ll be happy to see if I can provide additional troubleshooting
   steps.
 *  Plugin Author [Never Settle](https://wordpress.org/support/users/neversettle/)
 * (@neversettle)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/cron-rescheduling-error/#post-17979920)
 * Hello [@keepmovingdk](https://wordpress.org/support/users/keepmovingdk/),
 * I still cannot replicate this. The cron is instantiated once all plugins are 
   active and enabled. If you can, try disabling other plugins and only using cloner
   to check if the notice appears. Alternatively if this is not possible, you can
   try on a different installation of WordPress.
 *  [Kim Hornung](https://wordpress.org/support/users/keepmovingdk/)
 * (@keepmovingdk)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/cron-rescheduling-error/#post-17980164)
 * Thank you for your patience. I’m able to reproduce it on two different installations(
   one a local installation, the other our production site).
 * The notice also appears with no other plugins active.
 * I’m not sure why you are not able to reproduce it. Maybe because the wp-cron.
   php only causes the warning if there are active cron jobs ready for execution
   and if the ns_cloner_cron needs to be rescheduled.
 * It’s correct that the cron is instantiated after plugins are active and enabled.
   But in the the **__construct()** method of the** NS_Cloner** class you have the
   following line 178:
 *     ```wp-block-code
       $should_load = is_admin() || ( wp_doing_ajax() && is_user_logged_in() ) || ( defined( 'WP_CLI' ) && WP_CLI ) || ns_is_signup_allowed();
       ```
   
 * When wp-cron.php is being run in my environment, none of these conditions are
   true which leads to the warning.
 * To fix this, the line could be changed to also check for wp_doing_cron():
 *     ```wp-block-code
       $should_load = is_admin() || ( wp_doing_ajax() && is_user_logged_in() ) || wp_doing_cron() || ( defined( 'WP_CLI' ) && WP_CLI ) || ns_is_signup_allowed();
       ```
   
 * It’s fair enough if you don’t want to make this change unless other people also
   report the problem 🙂 
   But I hope you find a way to reproduce it.
 *  Plugin Author [Never Settle](https://wordpress.org/support/users/neversettle/)
 * (@neversettle)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/cron-rescheduling-error/#post-17980303)
 * Hey [@keepmovingdk](https://wordpress.org/support/users/keepmovingdk/),
 * Thanks for the assistance. Yes, this should fix the issue
 *  [jdarbuckle](https://wordpress.org/support/users/jdarbuckle/)
 * (@jdarbuckle)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/cron-rescheduling-error/page/2/#post-17980867)
 * Great stuff [@keepmovingdk](https://wordpress.org/support/users/keepmovingdk/)!
 *  [nhanvillas](https://wordpress.org/support/users/nhanvillas/)
 * (@nhanvillas)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/cron-rescheduling-error/page/2/#post-18128646)
 * Hi Authors,
 * I have a value which return null when I call **ns_cloner()->schedule->add() **
   to clone my site via API in my plugin and i have active cloner pro plugin and
   site copier plugin but it isn’t work. Can you show me how to fix this error ?
 * My request data:
 * [template_blog_id] => 2 [subdomain] => jodi [title] => Jodi Orosz [options] =
   > {“owner_key”:”52c1e6cb377600412bc81978ad677bf43eb2b54e”,”api_key”:”Y2IzZGVhOWFiMGZlYWM1NTU2Y2E4NDBmOTkyYTc2Zjg1ZTViZjFlOQ
   ==”,”api_password”:”ZmU4NWZhZTJlODgyZmY0MzJiMzM4MDc4MDhjNjE4MDY4Zjc1MTJhMw==”,”
   owner_username”:”jodi”,”owner_365_email”:”jodi@5ba1-3-442a-9ad0-bookings.com”}[
   wp_new_user] => {“username”:”jodi”,”email”:”jodi@5ba1-3-442a-9ad0-bookings.com”}
 * My url endpoint: [ttps://example.com/wp-json/365villas/api/v1/sites/create](https://example.com/wp-json/365villas/api/v1/sites/create)
 * My Errors:
 * <b>Fatal error</b>: Uncaught Error: Call to a member function add() on null in/
   home/sierralite/public_html/wp-content/plugins/villas-365-api/api/class-villas-
   365-api-sites.php:760 Stack trace: #0 /home/sierralite/public_html/wp-includes/
   rest-api/class-wp-rest-server.php(1230): Villas_365_API_Sites-&gt;siteCreate()#
   1 /home/sierralite/public_html/wp-includes/rest-api/class-wp-rest-server.php(
   1063): WP_REST_Server-&gt;respond_to_request() #2 /home/sierralite/public_html/
   wp-includes/rest-api/class-wp-rest-server.php(439): WP_REST_Server-&gt;dispatch()#
   3 /home/sierralite/public_html/wp-includes/rest-api.php(420): WP_REST_Server-&
   gt;serve_request() #4 /home/sierralite/public_html/wp-includes/class-wp-hook.
   php(324): rest_api_loaded() #5 /home/sierralite/public_html/wp-includes/class-
   wp-hook.php(348): WP_Hook-&gt;apply_filters() #6 /home/sierralite/public_html/
   wp-includes/plugin.php(565): WP_Hook-&gt;do_action() #7 /home/sierralite/public_html/
   wp-includes/class-wp.php(418): do_action_ref_array() #8 /home/sierralite/public_html/
   wp-includes/class-wp.php in <b>/home/sierralite/public_html/wp-content/plugins/
   villas-365-api/api/class-villas-365-api-sites.php</b> on line <b>760</b><br /
   >

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Cron rescheduling error’ is closed to new replies.

 * ![](https://ps.w.org/ns-cloner-site-copier/assets/icon-256x256.gif?rev=2323308)
 * [NS Cloner - Site Copier](https://wordpress.org/plugins/ns-cloner-site-copier/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ns-cloner-site-copier/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ns-cloner-site-copier/)
 * [Active Topics](https://wordpress.org/support/plugin/ns-cloner-site-copier/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ns-cloner-site-copier/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ns-cloner-site-copier/reviews/)

 * 18 replies
 * 5 participants
 * Last reply from: [nhanvillas](https://wordpress.org/support/users/nhanvillas/)
 * Last activity: [1 year, 7 months ago](https://wordpress.org/support/topic/cron-rescheduling-error/page/2/#post-18128646)
 * Status: resolved