Support » Plugin: WP Crontrol » Unable to delete (now) Event

  • Hi,

    we are using WP Crontrol to execute scripts from WP All Import. Basically starting script that imports products into WooCommerce from a csv file on our FTP server.

    The imports from WP All Import have an ID, and we are referring to that ID in WP Crontrol through a PHP Cron Event.

    My problem is that I’m unable to delete an Event for a previous Import (that is now deleted).

    It’s always set to (now). It also creates another Event for the same ID. So in total I have 3 Events but only one of those is the correct one. It is always at the top of my list of jobs. So there are two Events I don’t want, but can’t delete.

    The cronjob I’m trying to delete says it’s running now, for reasons unknown to me. When I change the date of this cronjob to a date in the future, the plugin creates ANOTHER cronjob with that start date in the future. It keeps the original job that says it’s running now.

    * How many cron jobs do you have in total?
    18 jobs, but we’re only trying to run one custom event. The rest are WP default stuff.

    * Do you have any other PHP cron events?
    We are only trying to run one PHP Cron event, but currently there are 3 due to the duplicates we can’t get rid of.

    * Are any other cron jobs scheduled for the same time as the one that won’t delete?
    No

    * Does the problem happen every time?
    Yes

Viewing 9 replies - 1 through 9 (of 9 total)
  • Piggybacking onto this @admoment post, since we’re in the same camp.

    Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    Does the behaviour remain if you deactivate the WP All Import plugin? It could be that the plugin immediately recreates the cron event as soon as you delete it. (WordPress core does this for several of its own cron events.)

    I haven’t, but will try right now!

    Oh, that’s not me. We don’t have WP All Import running.

    Yeah, unfortunately deactivating WP All Import does not help. Same issues. I spoke to WP Engine (hosting) and they tried to remove the crons server side and still couldn’t get rid of them.

    Here’s their reply:

    I’ve been working to remove the cron job that we talked about in our chat. I attempted to delete it, but it seems that my tool went and deleted all of the cron jobs with that hook (unfortunately including the one you wanted to keep) but it did not remove the one we wanted to get rid of.

    – next –

    Alright, tried to delete that cron sitting at the top, seems to have had the expected behavior. I did get an entry in the debugging though;

    [22-Feb-2018 12:00:19 UTC] PHP Warning: file_get_contents(http://sitename.w…d=12&action=processing): failed to open stream: HTTP request failed! in /nas/content/live/sitename/wp-content/plugins/wp-crontrol/wp-crontrol.php(71) : eval()’d code on line 2

    Seems to be trying to use a semi-colon in the URL it’s trying to use, and as far as I can tell, it’s not actually specifying a file in the URL.

    Unfortunately with serialized arrays, if they put in to the table incorrectly, it generally breaks things and causes WordPress to put in the default cron jobs there. I had the original array saved in a text file so I was able to put it back, but I can’t sort out the array to just remove the specific crons we want gone.

    – – –

    Does that help?

    Traditional approaches to deleting these cron jobs are not working as expected. I was able to successfully delete them only by manually removing all cron jobs via phpMyAdmin.

    We host at WP Engine, but I assume the same method can work for other hosts as well:

    1. Take a backup of your live site.

    2. Using phpMyAdmin select the YOURDATABASE database => SQL Tab and use the following statement to delete the cron option

    UPDATE wp_options SET option_value = '' WHERE option_name = 'cron'

    3. Deactivate and reactivate plugins that add cron events on activation. In my case this only applied to woocommerce.

    • This reply was modified 1 year, 8 months ago by admoment.

    We are experiencing similar issues to the OP.

    Hosted on WPE, using WPAI, along with Woocommerce & a bunch of other plugins.

    We cannot reliably delete custom cron jobs (php & regular). Sometimes it works, sometimes it does nothing & other times it deletes the wrong one (although this seems to be only happen to duplicated crons, as below).

    We are also seeing PHP cron jobs being duplicated when trying to edit their reoccurrence.

    I just tried the other main WP Cron plugin but it doesn’t support PHP (and other issues) so I’m keen to get this sorted.

    We are having the same issue where we cannot delete cron jobs that have these characteristics:

    1. Our custom PHP cron events
    2. The Next Run date has already past
    3. The time is appended with (now)
    4. Modifying the date or frequency creates another cron job

    We deactivated/activated WP Cron, then tried to delete one of these cron jobs. This message is displayed:
    Successfully deleted the cron event crontrol_cron_job.
    But, it is still listed.

    Please help.

    I used admoment’s suggestion above – deleting through the plugin doesn’t work. You need to go into the db & delete it there. Unfortunately, you’ll delete everything. Be sure to document ALL the crons you created so you can re-create them. We only had a couple, so other than the minor heart attack of deleting something directly in the db & hoping you didn’t screw things up, it went ok.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Unable to delete (now) Event’ is closed to new replies.