• Resolved LELF

    (@eldredge)


    Hello,

    How and can I delete duplicate cron jobs with the same name of ‘wp_privacy_delete_old_export_files.’ I have over 1800 scheduled cron events with this name. Some have the same date, whereas others do not. I just need one ‘wp_privacy_delete_old_export_files’, not 1800 of them.

    They all say, ‘One or more cron events have missed their schedule.’

    Does anyone know 1. Can I delete them and 2. How do I delete them? I have researched for an answer, any help would be appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    You could use wp_unschedule_event() in a loop if you have adequate data about each event and are able to write code that can distinguish good from bad.

    The needed data could be extracted from the option “cron”. You could actually have your code directly unset the undesirable elements in the cron option array, then save the updated array back to the DB. I recommend saving the current, unaltered value somewhere safe. If you accidentally corrupt the array structure it could break the entire wp-cron scheme. You’d want a way to revert back to the original value.

    If such custom coding is beyond your means, try one of the plugins intended for cleaning and optimizing your database.

    Thread Starter LELF

    (@eldredge)

    Thank you, @bcworkz, I wrote WPBeginning and Jeremy provided this website https://wordpress.stackexchange.com/questions/175878/delete-thousands-of-cron-jobs and it worked. Super happy!

    For those who are reading this and looking for the same answer as me, this is what I did.

    1. BACKED UP my site!!!!!
    2. Visit this url https://wordpress.stackexchange.com/questions/175878/delete-thousands-of-cron-jobs
    3. I installed WP Control to see the results. This plugin is lightweight (50kb)
    4. Took a screenshot of the custom plugins only.
    5. I followed this part “I logged on to phpMyAdmin. I clicked on my database and then the ‘search’ tab. I typed in ‘cron’ then selected ‘all tables’ and clicked ‘Go’. I scrolled down the search results list to my wp_options table. I clicked ‘Browse’. At the top of the list was option_name ‘cron’. I clicked ‘Edit’ then waited for the page to load. I clicked on the box that showed the list of cron jobs. The cron list was so long that it took about 80 seconds for my cursor to respond. I then used Ctrl-A on the keyboard to select all before hitting the delete button. It took about 2 minutes before my browser completed the deletion (chrome timed-out so I tried Firefox which worked).”

    Some of the cron events did not come back, because of the screenshot I took of the custom cron events this helped me to know which ones were not added back. If you need further assistance on how to get the custom cron event back, I would contact the plugin provider.

    • This reply was modified 1 year, 4 months ago by LELF.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to delete duplicate cron events with the same name?’ is closed to new replies.