Title: Broken resync code fix
Last modified: April 10, 2023

---

# Broken resync code fix

 *  Resolved [kw11](https://wordpress.org/support/users/kw11/)
 * (@kw11)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/broken-resync-code-fix/)
 * Hello,
 * Your resync feature doesn’t work right if I delete all customers/orders. This
   is because your cron schedule isn’t initializing
   Please have your developers 
   replace the cron schedule code in omnisend-woocommerce.php with this.
 * `add_action( 'wp_loaded', function() {
    add_filter( 'cron_schedules', function(
   $schedules ) { $schedules['two_minutes'] = array( 'interval' => 60 * 2, 'display'
   => __( 'Every 2 minutes', 'omnisend-woocommerce' ), ); return $schedules; });});
 * Cron schedules should be initiated after wp_loaded. This code will fix the problem.

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

 *  Thread Starter [kw11](https://wordpress.org/support/users/kw11/)
 * (@kw11)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/broken-resync-code-fix/#post-16641047)
 * I also wanted to suggest being able to sync wordpress/woocommerce custom fields
   or tags from WordPress to Omnisend. So far, I’ve looked at how your plugin does
   tags and this shouldn’t be too hard for contacts.
   Just a simple settings page
   to select the wordpress custom fields that will correspond to tags, etc. for 
   users. Then you add a couple lines of code in class-omnisend-contact.php so these
   tags are automatically synced to contacts.You’ll really stand out from the competition
   if you add some basic features that allow users to segment any way they want.
    -  This reply was modified 3 years, 2 months ago by [kw11](https://wordpress.org/support/users/kw11/).
 *  Thread Starter [kw11](https://wordpress.org/support/users/kw11/)
 * (@kw11)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/broken-resync-code-fix/#post-16642750)
 * Sorry, might be more appropriate to use init(), but both will work. This also
   doesn’t change your function names or overall structure.
   Use this instead if 
   desired.
 *     ```wp-block-code
       /*Add a custom cron schedule for every 2 minutes*/
       function omnisend_2min_cron($schedules) {
           $schedules['two_minutes'] = array(
               'interval' => 60 * 2,
               'display' => __('Every 2 minutes', 'omnisend-woocommerce')
           );
           return $schedules;
       }
   
       /*Initialize the custom cron schedule on init*/
       function omnisend_initialize_cron_schedule() {
           add_filter('cron_schedules', 'omnisend_2min_cron');
       }
       ```
   
    -  This reply was modified 3 years, 2 months ago by [kw11](https://wordpress.org/support/users/kw11/).
 *  Thread Starter [kw11](https://wordpress.org/support/users/kw11/)
 * (@kw11)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/broken-resync-code-fix/#post-16643010)
 * Wish I could edit threads for longer. I missed a line of code. And this new block
   editor commenting system gives me problems. Here it is again.
 *     ```wp-block-code
       /*Add a custom cron schedule for every 2 minutes*/
       function omnisend_2min_cron($schedules) {
           $schedules['two_minutes'] = array(
               'interval' => 60 * 2,
               'display' => __('Every 2 minutes', 'omnisend-woocommerce')
           );
           return $schedules;
       }
   
       /*Initialize the custom cron schedule on init*/
       function omnisend_initialize_cron_schedule() {
           add_filter('cron_schedules', 'omnisend_2min_cron');
       }
       add_action('init', 'omnisend_initialize_cron_schedule');
       ```
   
    -  This reply was modified 3 years, 2 months ago by [kw11](https://wordpress.org/support/users/kw11/).
 *  [Eduard Doloc](https://wordpress.org/support/users/rwky/)
 * (@rwky)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/broken-resync-code-fix/#post-16675725)
 * Why don’t you contact their support? They can connect you with their dev team.

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

The topic ‘Broken resync code fix’ is closed to new replies.

 * ![](https://ps.w.org/omnisend-connect/assets/icon-256x256.gif?rev=3149930)
 * [Email Marketing for WooCommerce by Omnisend](https://wordpress.org/plugins/omnisend-connect/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/omnisend-connect/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/omnisend-connect/)
 * [Active Topics](https://wordpress.org/support/plugin/omnisend-connect/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/omnisend-connect/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/omnisend-connect/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Eduard Doloc](https://wordpress.org/support/users/rwky/)
 * Last activity: [3 years, 1 month ago](https://wordpress.org/support/topic/broken-resync-code-fix/#post-16675725)
 * Status: resolved