Questions tagged [cron]

The tag has no usage guidance.

101 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3 votes
1 answer
736 views

Scheduled Posts and wp-cron - Why don't scheduled posts publish if too old?

I notice that the documentation for wp_schedule_single_event mentions the following:- The action will fire off when someone visits your WordPress site, if the schedule time has passed. However ...
user1954882's user avatar
3 votes
0 answers
1k views

wp_schedule_single_event function not working

I am testing the wp_schedule_single_event function and it is currently not working on my upgraded version of wordpress. It looks like the event is being scheduled but the code in my hook is never ...
DiverseAndRemote.com's user avatar
3 votes
0 answers
56 views

How ( and mostly at what time ) can i prevent the alternate cron from running?

I'm using the alternate cron version, but i need to prevent it from running on some calls, how can i do this? In the cron.php file i've seen on line 225 if ( defined('ALTERNATE_WP_CRON') && ...
Nicola Peluchetti's user avatar
2 votes
0 answers
189 views

Scheduling posts on wordpress adds wrong seconds as post_date

When scheduling a post in wordpress, e.g. 15:50, I always see that as time there are always seconds added at the end, e.g. 15:50:48, which ruins my cronjobs and makes them run 1 minutes later (if I ...
Кристиян Кацаров's user avatar
2 votes
0 answers
379 views

How refresh wp_schedule_event without restart a plugin

I create option page for set optional recurrence (daily or hourly wp_schedule_event, when I change for example, from daily to hourly through option page in back-end, how can I fire wp_schedule_event ...
M. Ferdosiyan's user avatar
2 votes
1 answer
2k views

Does wp-cron runs all tasks scheduled at same time together or one after other?

I am developing a plugin and want to add a cron task(let's say cron_task_test) but have a doubt. In case 15 tasks(they may be scheduled by multiple plugins or the user himself) are scheduled to run at ...
learning_13's user avatar
2 votes
1 answer
2k views

execute function in wordpress plugin using crontab

So, I want to run a function on my plugin from crontab. For the example, I want to run it every day at 1:10am function my_cronjob_action () { //this function is in my plugin // code to ...
Fatimah Wulandari's user avatar
2 votes
0 answers
618 views

"Error establishing database connection" when trying to run script through crontab

I'm trying to run a function every 60 minutes using crontab in an elasticbeanstalk environment in AWS, this is my cron: */2 * * * * cd /var/www/html; /usr/bin/php /var/www/html/import_jobs_cron.php ...
aabreu's user avatar
  • 221
1 vote
1 answer
155 views

Does using WP-cron make the site slower for the user?

Forgive my "beginnerness" in this matter but I have 2 options to trigger a heavy task (massive update on users' properties to solve an issue between 2 plugins that weren't meant to cooperate)...
Iago's user avatar
  • 11
1 vote
0 answers
236 views

export a csv file from the database with a cronjob

I'm using an event plugin, which doesn't have a user-friendly function for showing a list of bookings. That's why I wrote a php+js script myself to display that data in a nice way. But to use my own ...
mathiflip's user avatar
1 vote
0 answers
894 views

Wordpress cron not getting executed when called by external service (but ok from browser)

I'm trying to set up an external cron service to run cron in my WP site. I have disabled WP's own cron using define('DISABLE_WP_CRON', true); in wp-config.php. As for the URL to call from the external ...
Albert's user avatar
  • 141
1 vote
0 answers
55 views

Scheduling update post daily

I have created a function to change the post category to archive after expiry date. And it will update every time when I save a post. But the question is that how can I schedule an update for posts ...
gabriel's user avatar
  • 11
1 vote
0 answers
295 views

Manual Cron job occasionally outputting WP die message

I have some manual cron jobs running on my server hourly - they seem to generally fire fine, but occasionally they output the WP die message page html (see below) to the cron output logs which i have ...
Ryan Smith's user avatar
1 vote
0 answers
204 views

Programmatically save one/any post

I am using WP All import in order to import listings in a website. Everything works well except displaying all listings in a map. If i edit any listing, and then click Update (without making any ...
kouts34's user avatar
  • 11
1 vote
1 answer
528 views

Server cron job not working

I want to setup server cron job for my WordPress website. This is what I have done so far. I added this line to my wp-config file. define('DISABLE_WP_CRON', true); I added this command for setting ...
wplearner's user avatar
  • 489
1 vote
1 answer
269 views

Issues When Recursively Calling wp_schedule_single_event()

I run a site where I make an external API call. I want to have a failure case such that, if the API call fails, it will call wp_schedule_single_event() to re-try the API call in +4 hours. If that ...
Sam's user avatar
  • 11
1 vote
1 answer
654 views

How to bypass maintenance mode with external cron?

I'm using crontab to run a php script loaded with wp-load.php with absolute path. However, when I go to maintenance mode, the file can't run. I'm using Coming soon plugin. Is there a way to exclude ...
Jean R.'s user avatar
  • 111
1 vote
0 answers
110 views

Problem with automatic role change through cron job

I have a function called by a daily cron job that automatically changes the role of users after a period of time. The 1st role update should happen 120 days after registration, and a 2nd role update ...
Cyrille Kriegel's user avatar
1 vote
1 answer
59 views

Is there way to run a code every time when any cron is run?

publish_post is an action triggered whenever a post is updated and its new status is "publish". Is there similar action which is trigger when cron is run including WordPress default crons? I am ...
I am the Most Stupid Person's user avatar
1 vote
0 answers
159 views

wp-cron behaviour when there are multiple queued tasks

Ive experimenting with using a server side cron to execute wp-cron instead of Wordpress, as suggested by countless articles. What I don't quite understand is how wp-cron is supposed to deal with ...
Michae Pavlos Michael's user avatar
1 vote
0 answers
594 views

How wp-cron can run in background if PHP is single threaded?

I read that wp-cron runs when a page load request comes. So, if PHP is single threaded how can all the cron jobs run as a separate task? If that's not the case, may anyone please help to understand ...
learning_13's user avatar
1 vote
0 answers
1k views

Cron job script - loading wordpress system fails

I want to run a cron job that fetches data from an api and stores it in a database table. I don't use "wp-cron". I load a script in a folder inside the theme. But I need to load the wordpress system ...
Galivan's user avatar
  • 243
1 vote
3 answers
3k views

WP Cron job timeout issues

I have to run a php function for around 10 minutes. Now I am sheduling the job as a wp-cron-job. But it is getting timed out after 30seconds which is the maximum execution time for php. How to get rid ...
Stanly's user avatar
  • 111
1 vote
0 answers
646 views

Wordpress Cron Job Not working

can you help me with this please, what am I missing? This one works: if ( ! wp_next_scheduled( 'my_hook_2' ) ) { wp_schedule_event( time(), 'hourly', 'my_hook_2' ); } add_action( 'my_hook_2', '...
HOY's user avatar
  • 291
1 vote
0 answers
872 views

running wp-cron.php using php not wget

I operate some servers which have a few WordPress websites on them. I was having some issues with the cron jobs being triggered too often or not enough so I replaced all of them with crontab entries, ...
William Power's user avatar
1 vote
0 answers
499 views

Cron job not working - Can't see in the queue attached

I have a custom schedule defined for a cron job to be triggered. This is how my code looks: <?php //wp-config define('DISABLE_WP_CRON', true); //Plugin file register_activation_hook( '__FILE__', '...
Rutwick Gangurde's user avatar
1 vote
0 answers
232 views

wp cron job fires at every second or so, if callback is wrapped with DOING_CRON check it never fires at all

I am a bit lost while dealing with a open source plugin implementing wp cron. You can read about the problem on github https://github.com/nekojira/wp-currencies/issues/6#issuecomment-116735909 - I ...
unfulvio's user avatar
  • 1,814
1 vote
0 answers
292 views

Set post to unpublished after one week depending on condition

I have a post type with a custom field checkbox. If this checkbox is checked and the post is published, I want to unpublish when one week has passed since last modified date. How would I go about ...
Johan Dahl's user avatar
  • 1,343
1 vote
0 answers
129 views

Store partial database to an archive database time to time

As the community knows me that I'm not a PHP Developer by core, but trying to be one. With the company I'm working, I developed many WordPress powered News Portals, where- They publish at least 30 - ...
Mayeenul Islam's user avatar
1 vote
0 answers
337 views

Is it possible to use `wp_schedule_event` with real cronjobs?

I hate the way Wordpress Cron Jobs run, so I disabled them: define('DISABLE_WP_CRON', true); and want to run a real cron job instead: wget http://www.myserver.com/wp-cron.php > /dev/null 2>&...
Myself's user avatar
  • 11
1 vote
0 answers
78 views

Problems with cron

I have a this code that delete some post meta at al 7:55 hour of the server: if ( !wp_next_scheduled('borra_meta_datos') ) { wp_schedule_event( mktime(7, 55, 0, date('n'), date('j')), 'daily', '...
kentverger's user avatar
0 votes
0 answers
6 views

Scheduled parsing of XML feed into wp_insert_post()

I coded a custom theme that parses and imports into a CPT the content of some multi page XML feeds. This it the current workflow: daily action scheduled for 2am with action-scheduler to process all ...
Mihai Papuc's user avatar
0 votes
0 answers
13 views

What are scheduled callbacks?

I was taking a look at the inner workings of the Cron System, and found something odd: apparently, you can set a callback to event recurrence schedules. However, I can't find any documentation on that ...
Buzu's user avatar
  • 101
0 votes
0 answers
24 views

How to get cron name which calls my function

I need to send to users who have birthdays an email with a coupon, and I don't want the emails to be sent in very quick succession. I want to send them in 1 second intervals. I implemented the idea of ...
Vlado's user avatar
  • 111
0 votes
0 answers
14 views

WP Cron, how to speed it up

On my site, I have quite a few cron jobs running. Everything is running smoothly, except the cron jobs end up queuing all time. My server load is only at 40%, so I assume I can handle more cron jobs ...
Mads's user avatar
  • 1
0 votes
1 answer
22 views

CPU Overloading due to some hooks

I have some functions restricted in some hooks. The purpose of these hooks was to have consistent author name in the DB(which is a product attribute) and also update the display name. I placed this in ...
Varun Muchanapally's user avatar
0 votes
0 answers
623 views

How to run cronjobs in WordPress on docker

I am running a WordPress site in a docker container. The site works but the cronjobs do not run so I downloaded crontrol to get a GUI into crontab so I could confirm that the jobs existed and I see ...
steve8094's user avatar
0 votes
0 answers
21 views

WordPress Cron Job not importing products

I think this issue is related to WordPres Cron System , because the function runs fine without cron but it doesn't work as expected when run via cron , please have a look : https://wordpress.org/...
rawaha johns's user avatar
0 votes
1 answer
297 views

What is the correct way to implement wp-cron server-side in Kubernetes?

I'm not sure if this is the correct place to ask the question, but since this is specific to deploying WordPress, I thought I'd ask here first. What is the correct way to implement wp-cron server-side ...
JakGuru's user avatar
0 votes
0 answers
21 views

Custom cronjob not executing at all, but manually

In my themes function.php, I've added that code to load a custom code based on the cron: add_action( 'wp', 'schedule_test_cron' ); function schedule_test_cron() { if ( !wp_next_scheduled( 'test_cron'...
John_H_Smith's user avatar
0 votes
0 answers
19 views

Creating a background process that doesn't need HTTP

I want to fetch data from an ERP system and use that to fill the Woocommerce products. This operation is quite memory intensive and lengthy. So I'd like to run this through a cron that just calls a ...
Guido Goluke's user avatar
0 votes
1 answer
179 views

‘wp_site_health_scheduled_check’ Causes Failure Of Other Scripts

I introduced a heartbeat monitoring system on all my websites late last year. The system involves using a wp-cron action to send a GET request to an API hosted by Better Uptime, triggered by crontab ...
David Adams's user avatar
0 votes
0 answers
326 views

How to know if WP cron is currently running my hook?

I have an action that calls a function which takes about 20 seconds to complete (uploading file to remote server). How can I code it in such a way so that it could check if WP cron is running the same ...
ratib90486's user avatar
0 votes
1 answer
286 views

wp_mail sending only once inside foreach loop

I have written and re-written this code several times. I've tried removing the wp_mail function from the loop and putting it in it's own function. I've moved all the variables in to the loop. At one ...
Hylland's user avatar
0 votes
0 answers
80 views

Certain lines added to our wp-config.php file are being removed, every day

It seems that certain lines added to our wp-config.php file are being removed, every day at 01:00. The line that's being removed is define('WP_ENVIRONMENT_TYPE', 'staging'); Which is added just ...
Ralpharama's user avatar
0 votes
0 answers
45 views

3,840 cronjobs with no action!

I have a site which constantly has nearly 4,000 cronjobs with no action. If I delete a number of these jobs they come right back, generally to the same number. I've tried switching back to the Twenty ...
Sandbox Wizard's user avatar
0 votes
0 answers
174 views

How can i find the cron jobs that run on my site and then move them to the server side?

I am trying to find all the cron jobs on my site and then, move them to the server-side, as my hosting provider gives me the option, to schedule them on the server. I am aware of some plugins like ...
Efstef's user avatar
  • 11
0 votes
0 answers
430 views

Wordpress cron job running more than once

I developed a plugin to read some XML files and publish their itens as post but for some reason, sometimes, it is duplicating posts. Basically that is what I have: // function one is scheduled (hourly)...
José Leonardo's user avatar
0 votes
1 answer
154 views

Auto Delete Users (auto_delete_users)

I need some help cause I couldn't find any solution for my problem and haven't the knowledge to solve the problem on my own. What I'm trying to do: I want to delte every WordPress user (subscriber) ...
Still Ready's user avatar
0 votes
1 answer
1k views

Time limit on long cron job?

I'm working on a membership system which is going to process renewal payments. If I use set_time_limit(0) inside the wp_schedule_event (cron) function, is that enough to ensure that it has the time it ...
Chad Reitsma's user avatar