Title: wp_cron
Last modified: May 29, 2020

---

# wp_cron

 *  [darick0029](https://wordpress.org/support/users/darick0029/)
 * (@darick0029)
 * [6 years ago](https://wordpress.org/support/topic/wp_cron/)
 * Hi there,
 * Please allow me to ask this question. First of all my goal that im trying to 
   achieve is deleting thousands of post after the import but the process should
   have to be in the background. meaning even if they close the website the deletion
   will continue until its finished.
 * So my question is:
    If i manage to trigger the wp_cron which is i already did.
   will it end if all of the post needed to be deleted is already done? or will 
   it repeat? because the wp_cron is being called at the end of the import to delete
   the posts.
 * And does wp_cron the best way to run process in the background? or is there another
   wp method or function that can do process in the background even if the browser
   is already closed.

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

 *  [Matt Robinson](https://wordpress.org/support/users/mattyrob/)
 * (@mattyrob)
 * [6 years ago](https://wordpress.org/support/topic/wp_cron/#post-12911540)
 * [@darick0029](https://wordpress.org/support/users/darick0029/)
 * This page may assist you with details:
    [https://developer.wordpress.org/plugins/cron/](https://developer.wordpress.org/plugins/cron/)
 * But to answer briefly, wp_cron runs on a page load on the site, so if you set
   everything up and then the site is closed and never visited again – the process
   will not complete. If you try to do too much the site will become slow and likely
   as not hit a server level timeout if you are trying to delete thousands of posts
   so ideally they should be done in batches.
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [6 years ago](https://wordpress.org/support/topic/wp_cron/#post-12912143)
 * Deleting in manageable batches through wp_cron is a good way to accomplish the
   task. For the sake of throwing out alternative ideas, you could instead manually
   trigger a batch delete by sending a specific request through /wp-admin/admin-
   post.php. The time out limit can be increased to allow more posts to be deleted
   at once. You could manually trigger the process at a time when your server load
   is low. Repeat as needed until all unwanted posts are removed.
 * Of course a wp_cron task can be scheduled in the same manner. I think admin-post.
   php tasks are easier to set up than wp_cron. It’s similar to WP Ajax except no
   JavaScript is used. It’s less likely to adversely affect other users. Wp_cron
   can affect other users by its very nature.

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

The topic ‘wp_cron’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 2 replies
 * 3 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [6 years ago](https://wordpress.org/support/topic/wp_cron/#post-12912143)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
