Title: Randomly recycles multiple posts
Last modified: February 23, 2017

---

# Randomly recycles multiple posts

 *  Resolved [Ynah](https://wordpress.org/support/users/ynahpantig/)
 * (@ynahpantig)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/randomly-recycles-multiple-posts/)
 * We’ve been using this plugin for possibly more than a year now and it works perfectly
   except for a couple of times when it recycles 2 posts at the same time when in
   the settings, it is set to only recycle 1 per day. Here’s a screenshot of the
   settings ([http://pasteboard.co/BMdRyw8fr.png](http://pasteboard.co/BMdRyw8fr.png)),
   as well as a screenshot of a few of the crons that I have running ([http://pasteboard.co/BMevNMv35.png](http://pasteboard.co/BMevNMv35.png)).
 * Here’s the debug log for today as well:
 *     ```
       2017-02-23 01:04:58	- DEBUG: current time 0104 is not in allowed time range for (thu - 0300), no post check will occur.
       2017-02-23 02:04:47	- DEBUG: current time 0204 is not in allowed time range for (thu - 0300), no post check will occur.
       2017-02-23 03:04:57	- DEBUG: eligible posts WP_Query Array
       (
       [posts_per_page] => -1
       [cat] => 
       [post_type] => Array
       (
       [0] => question-for-the-day
       )
   
       [ignore_sticky_posts] => 1
       [post_status] => Array
       (
       [0] => draft
       [1] => pending
       [2] => publish
       )
   
       [order] => ASC
       )
   
       2017-02-23 03:04:57	- DEBUG: found 381 results.
       2017-02-23 03:04:57	- DEBUG: processing post What moves me and breaks my heart? How does this vulnerability motivate me?
       2017-02-23 03:04:57	- DEBUG: wp_update_post Array
       (
       [ID] => 1485
       [post_status] => publish
       [post_date_gmt] => 2017-02-23 08:04:57
       [post_date] => 2017-02-23 03:04:57
       )
   
       2017-02-23 03:04:57	- POST id 1485 RECYCLED: 'What moves me and breaks my heart? How does this vulnerability motivate me?'
       2017-02-23 03:06:00	- DEBUG: eligible posts WP_Query Array
       (
       [posts_per_page] => -1
       [cat] => 
       [post_type] => Array
       (
       [0] => question-for-the-day
       )
   
       [ignore_sticky_posts] => 1
       [post_status] => Array
       (
       [0] => draft
       [1] => pending
       [2] => publish
       )
   
       [order] => ASC
       )
   
       2017-02-23 03:06:00	- DEBUG: found 381 results.
       2017-02-23 03:06:00	- DEBUG: processing post Whom have I underestimated? What does this teach me?
       2017-02-23 03:06:00	- DEBUG: wp_update_post Array
       (
       [ID] => 1280
       [post_status] => publish
       [post_date_gmt] => 2017-02-23 08:06:00
       [post_date] => 2017-02-23 03:06:00
       )
   
       2017-02-23 03:06:00	- POST id 1280 RECYCLED: 'Whom have I underestimated? What does this teach me?'
       2017-02-23 04:04:58	- DEBUG: current time 0404 is not in allowed time range for (thu - 0300), no post check will occur.
       2017-02-23 05:04:49	- DEBUG: current time 0504 is not in allowed time range for (thu - 0300), no post check will occur.
       2017-02-23 06:04:48	- DEBUG: current time 0604 is not in allowed time range for (thu - 0300), no post check will occur.
       ```
   
 * Thanks!

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

 *  Plugin Author [johnh10](https://wordpress.org/support/users/johnh10/)
 * (@johnh10)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/randomly-recycles-multiple-posts/#post-8839772)
 * Looks like WordPress called the 2nd cron job about a minute after the 1st one.
   Best guess is a slow database lock, so WordPress didn’t know the 1st job was 
   running when the 2nd one was called.
 *  Thread Starter [Ynah](https://wordpress.org/support/users/ynahpantig/)
 * (@ynahpantig)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/randomly-recycles-multiple-posts/#post-8839825)
 * It’s very random though. Last time it happened was probably around mid-last year.
   Any suggestions on how to solve or avoid this issue?
 *  Plugin Author [johnh10](https://wordpress.org/support/users/johnh10/)
 * (@johnh10)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/randomly-recycles-multiple-posts/#post-8840122)
 * You could try using server cron jobs instead. Details in [FAQ](https://wordpress.org/plugins/auto-post-scheduler/faq/).
 *  Thread Starter [Ynah](https://wordpress.org/support/users/ynahpantig/)
 * (@ynahpantig)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/randomly-recycles-multiple-posts/#post-8843550)
 * Ok, I’ll try that out and let you know. Thanks!
 *  Thread Starter [Ynah](https://wordpress.org/support/users/ynahpantig/)
 * (@ynahpantig)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/randomly-recycles-multiple-posts/#post-8846831)
 * Hi John,
 * I tried doing that but it looks like it’s not running the wp crons anymore. We
   had one that would run a clear cache on W3TC and it looks like it didn’t run 
   that. Also, the “next auto post” check is also not being updated anymore. Here’s
   a screenshot ([http://pasteboard.co/CvZ4UvpZY.png](http://pasteboard.co/CvZ4UvpZY.png)).
   I’ve already manually cleared the cache from W3TC to make sure, but no luck.
 *  Plugin Author [johnh10](https://wordpress.org/support/users/johnh10/)
 * (@johnh10)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/randomly-recycles-multiple-posts/#post-8847248)
 * The server cron job has to fire to call wp-cron into order to process scheduled
   jobs.
 *  Thread Starter [Ynah](https://wordpress.org/support/users/ynahpantig/)
 * (@ynahpantig)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/randomly-recycles-multiple-posts/#post-8849750)
 * Hi John,
 * Yes, I did add that cron to the server as was instructed in the FAQ but it resulted
   to the last issue that I mentioned.
 * It looks like it’s becoming more frequent – it’s been recycling 2 posts for the
   last 2 days as opposed to 1 post which is in the settings.
 *  Thread Starter [Ynah](https://wordpress.org/support/users/ynahpantig/)
 * (@ynahpantig)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/randomly-recycles-multiple-posts/#post-8849770)
 * From what I notice in the logs, it’s only checking it twice (and posting twice)
   when it’s recycling something. Otherwise, when it’s only checking for the time
   range, it only checks once. Here’s a sample debug log:
 *     ```
       2017-02-25 13:04:49	- DEBUG: current time 1304 is not in allowed time range for (sat - 0300), no post check will occur.
       2017-02-25 14:04:48	- DEBUG: current time 1404 is not in allowed time range for (sat - 0300), no post check will occur.
       2017-02-25 15:04:49	- DEBUG: current time 1504 is not in allowed time range for (sat - 0300), no post check will occur.
       2017-02-25 16:04:51	- DEBUG: current time 1604 is not in allowed time range for (sat - 0300), no post check will occur.
       2017-02-25 17:04:50	- DEBUG: current time 1704 is not in allowed time range for (sat - 0300), no post check will occur.
       2017-02-25 18:04:49	- DEBUG: current time 1804 is not in allowed time range for (sat - 0300), no post check will occur.
       2017-02-25 19:04:51	- DEBUG: current time 1904 is not in allowed time range for (sat - 0300), no post check will occur.
       2017-02-25 20:04:58	- DEBUG: current time 2004 is not in allowed time range for (sat - 0300), no post check will occur.
       2017-02-25 21:04:53	- DEBUG: current time 2104 is not in allowed time range for (sat - 0300), no post check will occur.
       2017-02-25 22:05:01	- DEBUG: current time 2205 is not in allowed time range for (sat - 0300), no post check will occur.
       2017-02-25 23:05:03	- DEBUG: current time 2305 is not in allowed time range for (sat - 0300), no post check will occur.
       2017-02-26 00:04:56	- DEBUG: current time 0004 is not in allowed time range for (sun - 0300), no post check will occur.
       2017-02-26 01:04:47	- DEBUG: current time 0104 is not in allowed time range for (sun - 0300), no post check will occur.
       2017-02-26 02:04:48	- DEBUG: current time 0204 is not in allowed time range for (sun - 0300), no post check will occur.
       2017-02-26 03:04:48	- DEBUG: eligible posts WP_Query Array
       (
       [posts_per_page] => -1
       [cat] => 
       [post_type] => Array
       (
       [0] => question-for-the-day
       )
   
       [ignore_sticky_posts] => 1
       [post_status] => Array
       (
       [0] => draft
       [1] => pending
       [2] => publish
       )
   
       [order] => ASC
       )
   
       2017-02-26 03:04:48	- DEBUG: found 381 results.
       2017-02-26 03:04:48	- DEBUG: processing post Where can I find humor in my life right now?
       2017-02-26 03:04:48	- DEBUG: wp_update_post Array
       (
       [ID] => 1252
       [post_status] => publish
       [post_date_gmt] => 2017-02-26 08:04:48
       [post_date] => 2017-02-26 03:04:48
       )
   
       2017-02-26 03:04:48	- POST id 1252 RECYCLED: 'Where can I find humor in my life right now?'
       2017-02-26 03:05:48	- DEBUG: eligible posts WP_Query Array
       (
       [posts_per_page] => -1
       [cat] => 
       [post_type] => Array
       (
       [0] => question-for-the-day
       )
   
       [ignore_sticky_posts] => 1
       [post_status] => Array
       (
       [0] => draft
       [1] => pending
       [2] => publish
       )
   
       [order] => ASC
       )
   
       2017-02-26 03:05:49	- DEBUG: found 381 results.
       2017-02-26 03:05:49	- DEBUG: processing post How can I question myself and my daily patterns more skillfully?
       2017-02-26 03:05:49	- DEBUG: wp_update_post Array
       (
       [ID] => 1259
       [post_status] => publish
       [post_date_gmt] => 2017-02-26 08:05:49
       [post_date] => 2017-02-26 03:05:49
       )
   
       2017-02-26 03:05:49	- POST id 1259 RECYCLED: 'How can I question myself and my daily patterns more skillfully?'
       2017-02-26 04:04:47	- DEBUG: current time 0404 is not in allowed time range for (sun - 0300), no post check will occur.
       2017-02-26 05:04:48	- DEBUG: current time 0504 is not in allowed time range for (sun - 0300), no post check will occur.
       2017-02-26 06:04:54	- DEBUG: current time 0604 is not in allowed time range for (sun - 0300), no post check will occur.
       2017-02-26 07:04:48	- DEBUG: current time 0704 is not in allowed time range for (sun - 0300), no post check will occur.
       2017-02-26 08:04:47	- DEBUG: current time 0804 is not in allowed time range for (sun - 0300), no post check will occur.
       2017-02-26 08:04:52	- DEBUG: current time 0804 is not in allowed time range for (sun - 0300), no post check will occur.
       2017-02-26 09:05:07	- DEBUG: current time 0905 is not in allowed time range for (sun - 0300), no post check will occur.
       2017-02-26 10:04:48	- DEBUG: current time 1004 is not in allowed time range for (sun - 0300), no post check will occur.
       ```
   
 *  Plugin Author [johnh10](https://wordpress.org/support/users/johnh10/)
 * (@johnh10)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/randomly-recycles-multiple-posts/#post-8849900)
 * Yes, it still looks like the WordPress cron is calling APS twice, probably for
   the reasons I mentioned above.
 * If you tried using server cron jobs, and wp-cron is not being called, you will
   have to figure out why at the server level. The server error logs should have
   something if you mis-configured the cron entry or something else occurred.
 *  Thread Starter [Ynah](https://wordpress.org/support/users/ynahpantig/)
 * (@ynahpantig)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/randomly-recycles-multiple-posts/#post-8853705)
 * Hi John,
 * I just got it to work for my server. Here’s the cron line that fixed it (it is
   a bit different than the one that’s on your FAQ page the reason why I was having
   issues previously)
    `* * * * * wget -q -O - http://my.domain.com/wp-cron.php?
   doing_wp_cron >> /var/www/cronlog 2>&1`
 * Instead of
 *     ```
       */5 * * * * wget -q -O -"http://www.mydomain.com/wp-cron.php?doing_wp_cron='date +\%s'" > /dev/null2>&1
       ```
   
 * I wanted it to run every minute because we have a lot of other things running
   in the background.
 *  Thread Starter [Ynah](https://wordpress.org/support/users/ynahpantig/)
 * (@ynahpantig)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/randomly-recycles-multiple-posts/#post-9420837)
 * Hi John,
 * It looks like this issue is still happening very randomly with at least 3-4 months
   gap. I looked at the server error logs as you had suggested previously but there’s
   nothing there. The cron is running via server cron instead of wp-cron.
 * Any other thoughts?
 *  Plugin Author [johnh10](https://wordpress.org/support/users/johnh10/)
 * (@johnh10)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/randomly-recycles-multiple-posts/#post-9421594)
 * I tried a google search for “wordpress cron execute twice” and found [this page](https://wordpress.stackexchange.com/questions/74797/how-is-wp-cron-locking-implemented).
 * The answer mentions something you can try for the server cron job to try to avoid
   the cron job running twice.
 *  Thread Starter [Ynah](https://wordpress.org/support/users/ynahpantig/)
 * (@ynahpantig)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/randomly-recycles-multiple-posts/#post-9442053)
 * Thanks [@johnh10](https://wordpress.org/support/users/johnh10/). I’ll look into
   the link and let you know how it goes.

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

The topic ‘Randomly recycles multiple posts’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/auto-post-scheduler_bfcacf.svg)
 * [Auto Post Scheduler](https://wordpress.org/plugins/auto-post-scheduler/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/auto-post-scheduler/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/auto-post-scheduler/)
 * [Active Topics](https://wordpress.org/support/plugin/auto-post-scheduler/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/auto-post-scheduler/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/auto-post-scheduler/reviews/)

## Tags

 * [multiple posts](https://wordpress.org/support/topic-tag/multiple-posts/)
 * [recycle](https://wordpress.org/support/topic-tag/recycle/)
 * [settings](https://wordpress.org/support/topic-tag/settings/)

 * 13 replies
 * 2 participants
 * Last reply from: [Ynah](https://wordpress.org/support/users/ynahpantig/)
 * Last activity: [8 years, 9 months ago](https://wordpress.org/support/topic/randomly-recycles-multiple-posts/#post-9442053)
 * Status: resolved