wp-cron refers to a WordPress subsystem that allows for the scheduled execution of code

learn more… | top users | synonyms

11
votes
1answer
6k views

How to test wp_cron?

This is kind of a stupid question... I scheduled a action to run every hour: if(!wp_next_scheduled('my_hourly_events')) wp_schedule_event(time(), 'hourly', 'my_hourly_events'); ...
10
votes
1answer
2k views

PHP Warning on fresh install (Connection timed out)

I get this PHP Warning when accessing my fresh WordPress 3.4.1 install (Norwegian language). Warning: fopen(URL_TO_MY_WORDPRESS_PAGE/wp-cron.php?doing_wp_cron=1341476616.7605190277099609375000): ...
8
votes
4answers
2k views

WP Cron doesn't execute when time elapses

The goal I want to use wp_schedule_single_event( ) to execute a single event that sends me an e-mail 8 minutes after the user submits a form. The issue The following code is in my functions.php: ...
6
votes
3answers
4k views

Converting timestamps to local time with date_l18n()

I've got a WordPress cron job that sends an email periodically and saves the timestamp when it was sent as an option, and I'd like to display a date on a settings page. Something like, "The last ...
6
votes
2answers
834 views

Running WordPress on the Command Line - Turn off Delayed Output?

I'm creating a cron job that runs outside of WordPress. From a development perspective, this makes it really easy to debug and create cleanup scripts or cron jobs, by just running a command like the ...
5
votes
2answers
1k views

How to use wp_schedule_event in a class?

This is first time that I tried the OOP method of writing an application. I don't quite understand it yet. Currently I have this cron hook: if( !wp_next_scheduled( 'my_cron_hook' ) ) { ...
5
votes
1answer
249 views

wp_schedule_event won't accept args

I'm trying to schedule event on hourly basis but it doesn't work. Why, I can't understand. Here is a function that i use to schedule event. add_action( 'scheduled_update_feeds', 'update_feeds', 10, ...
4
votes
4answers
13k views

Why is ?doing_wp_cron being appended to my URLs

I'm finding this string appended to the end of my URLs sometimes: /?doing_wp_cron Does anyone know what it for? How can I remove it?
4
votes
1answer
302 views

wp_delete_auto_drafts() deletes links in menus

Since yesterday the wp_scheduled_auto_draft_delete cron job somehow deletes all page entries from our menus. All entries in the table wp_postmeta with meta_key = '_menu_item_object' and meta_value = ...
4
votes
1answer
384 views

When does next Cron Job run (time from now)?

I would need to know how much time is left between now and the next time a specifc Cron Job is done. For another answer I built a basic cron inspector plugin which can be found here. Reason I'm ...
3
votes
2answers
2k views

Using wp_schedule_single_event with arguments to send email

I'm trying to schedule a pseudo cron job to send an email after a set amount of time utilizing a WordPress plugin. So far, I've been able to make this code run when I hard code the email address and ...
3
votes
1answer
209 views

Which action for triggering cron “wp”or “init”?

Which one do you recommend using within a plugin and why? add_action( 'wp', 'trigger_me' ); function trigger_me() { if ( !wp_next_scheduled( 'my_plugin_cron' ) ) { ...
3
votes
2answers
1k views

Is there a quick way to view the wp-cron schedule

I'm trying to work which plugin is triggering wp-cron. I know about the code: http://codex.wordpress.org/Function_Reference/wp_get_schedules , but I'd prefer to do something in the sql backend rather ...
3
votes
1answer
216 views

Hourly WP schedule, do I need at least 1 visitor hourly?

I am planning to schedule an hourly task from my wp plugin, as I understand these tasks are triggered by visits to the website. So for an hourly task I will need at least one visitor hourly. Does it ...
3
votes
1answer
388 views

run a cron task without obstructing page load?

I have a plugin that lets users upload post attachments via AJAX in the admin area. I later try to push these files to DropBox via their REST API. It almost works. The issue is with WP cron task ...
3
votes
1answer
306 views

Trigger a cron every 24h GMT -8

I' like to run a cron every 24 hours at midnight PST ( = GMT -8 ) This is what I have if ( !wp_next_scheduled( 'cron_hook' ) ) { //reset on 00:00 PST ( GMT -8 ) == GMT +16 $timeoffset = ...
3
votes
1answer
339 views

Recurring scheduled task help

I'm trying to set up a scheduled task in my Wordpress installation which will (eventually) run a script to send an email once a day with a load of data in. However I can't seem to get a scheduled ...
3
votes
1answer
167 views

Using wp_cron with custom time interval and the register activation hook

Scenario 1: fails Adding a cron task wp_schedule_event with a custom interval on plugin activation using register_activation_hook outside the class definition fails to work because the custom ...
3
votes
1answer
298 views

Change post status based on meta value

I have this cron set up to trash posts x days after it is posted. This works. Edit: Added my answer to my question. add_action( 'wp', 'do_trash_ads' ); function do_trash_ads() { if ( ! ...
3
votes
2answers
580 views

Run WP Cron Weekly (but on a certain day)

I'm looking add-in a bit more speficity to the WP Cron intervals. To add a "weekly" interval, I've done the following: function re_not_add_weekly( $schedules ) { $schedules['weekly'] = array( ...
3
votes
1answer
222 views

Can't find wp-cron.php but I can see it in the public folder [closed]

I have a problem with the wp-cron.php file. I can see it when I browse the public folder and it has the permissions set to 755. But still I am getting this error in my server error log: [Thu Mar 15 ...
2
votes
2answers
734 views

What happens when wp_cron is deactivated in Wordpress?

In a Wordpress 3.5.1 the apache log generates the following error related to wp-cron.php: [18/Jun/2013:10:53:21 +0200] "POST /wp-cron.php?doing_wp_cron=1371545601.7393701076507568359375 HTTP/1.0" ...
2
votes
1answer
414 views

How Do I Make WordPress Run an Event Every Day?

In a plugin I want to build, it deals with contests. A contest has a date on it. Does WordPress have a feature in it where it can run a piece of code every day without requiring someone to create a ...
2
votes
3answers
407 views

How can I change the frequency of a scheduled event?

I have declared a scheduled event in a plugin like this : function shedule_email_alerts() { if ( !wp_next_scheduled( 'send_email_alerts_hook' ) ) { wp_schedule_event(time(), 'hourly', ...
2
votes
1answer
292 views

get_posts inside cron

Edited to rewrite my question I'll try to be as clear as possible, as I need to get this resolved quickly. I disabled WordPress' cron, and added a real cron job on my server to call wp-cron.php ...
2
votes
1answer
579 views

Some rogue WordPress plugin killing my server - how do I isolate and kill it?

Every so often my VPS server becomes unresponsive for no obvious reason. CPU usage is flat. No spike in traffic etc. When I run a top command on the machine (Centos) I can see that one of my sites has ...
2
votes
1answer
131 views

Long running action from plugin

I'm creating a WordPress plugin that will copy posts data to a remote database, I know it will take a while to transfer all the posts. How should I create copy functionality so it won't timeout? ...
2
votes
1answer
402 views

Do wp-cron scheduled tasks run asynchronously?

I have a task scheduled to run daily using wp-cron. The task takes over a minute to run (between downloading and parsing a very large file with cURL). According to the WP documentation, "The ...
2
votes
1answer
165 views

WP Cron and wp_insert_post

I'm trying to insert posts using a cron job, but I keep running into errors where WP is missing functions (is_user_logged_in, wp_get_current_user). Is there a proper way to run wp_insert_post using a ...
2
votes
1answer
192 views

WP Cron emails not working

Running wp 3.5.1. I have 2 plugins that work in part. They do everything nice. If I click to send emails, they send the emails. However the scheduled emails are not being sent. The plugins are: ...
2
votes
1answer
184 views

How to remove unused avatar uploads in buddypress [closed]

Im seeing in my wp-content/uploads/avatars folder that there are tons of avatars from when I created test users, but changed the avatars. So, i’m assuming that even if the user changes their avatar, ...
2
votes
0answers
79 views

How to run WP Cron the right way?

I have WordPress Multisite with several sites. I set up DISABLE_WP_CRON to true in my wp-config.php. How to run wp-cron.php the right way? If we set up cron task with wget or curl we have 30 sec ...
2
votes
1answer
160 views

Send email daily from WordPress site

I customized a calendar plugin which shows today's birthdays and current month's list of wedding anniversaries in the home page of the site. I wrote a code in that plugin's displaying page using ...
2
votes
1answer
94 views

Scheduling a task using class methods

I need to implement a scheduled task in my plugin, and I tried to follow the examples in the documentation, passing one of class methods as the target. I installed Cron Manager plugin, and I see that ...
2
votes
1answer
191 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 ...
2
votes
2answers
543 views

Missed scheduled WordPress

I am currently in version 3.1 of WordPress and I have a problem with planning my post. In fact, whenever I plan a post, it is written: "Scheduled missed. Could you help me please. Thank you in ...
1
vote
2answers
2k views

wp_schedule_event will it run if timestamp has passed?

I've been told by my clients that scheduled jobs are not run some times as expected. I never questioned myself about how wp_cron actually works, I thought it was kinda self-explanatory. But now I ...
1
vote
1answer
492 views

Schedule event every second thursday of the month

I'm working on an email system and they want it automated to send out emails every second thursday of the month. I've got the PHP sorted out and ready to fire a callback to send the emails, but I'm a ...
1
vote
1answer
252 views

Getting this code to work in Multisite

I'd like to run this code via cron on multisite. When I use the admin_init hook the code executes and works perfectly, deleting the blogs, however when I set it as a cron, and then run the event with ...
1
vote
2answers
370 views

WordPress Caching - Transients API or “update_user_meta ” Cronjob?

I'm trying to set user meta based on queries. Basically, things like IF the query returns true, set this or if not, set this (or don't set it, if it is true). This works great but the problem is I ...
1
vote
1answer
112 views

How to Better Control WordPress Cron Jobs?

I have a bunch of standalone WordPress sites, and WordPress Multisite Network of Sites on my server. There are times where there are too many sites all running cron jobs too soon in proximity. I am ...
1
vote
1answer
441 views

Scheduling posts to update once per day with wp_cron

I have a function that hooks into save_post that changes the value of a custom taxonomy term based on today's date. That's working fine. When I update a post, the taxonomy term is updated correctly. ...
1
vote
1answer
574 views

How do i schedule cron in wordpress for each second?

I want to schedule a cron job in Wp3.5.1 to sending email to those customer whose appointment is pending. here some code am trying: For the testing am scheduling corn for each second to insert row ...
1
vote
2answers
193 views

How is WP Cron Locking implemented?

WordPress takes measures to ensure that a cron task doesn't run twice when it should run once, e.g. once every hour when an hourly schedule is given, rather than the occasional twice at the scheduled ...
1
vote
2answers
818 views

Cron Job not working in plugin

I have written a plugin that will convert posts to excel format and then email the .xls to an email id. I can make it work with when function is declared in functions.php but does not work with ...
1
vote
2answers
279 views

Posts wont expire

I am having some trouble with scheduling posts to automatically expire (either by deleting or going to draft), every plugin I have tried does nothing and when it reaches the scheduled time nothing ...
1
vote
1answer
199 views

Cron jobs in a class

Having: pluginname.php // If this file is called directly, abort. if ( ! defined( 'ABSPATH' ) ) { die(); } define('PLUGINNAME_PLUGIN_URL', plugin_dir_url( __FILE__ )); ...
1
vote
1answer
453 views

How to make sure a wp-cron job runs

I am using a plugin to send emails to a relatively large email list. Because we have a low per-hour email threshold from our host we have to use a setting in the plugin to throttle the emails down to ...
1
vote
3answers
706 views

Run a cron job (or similar) in the background of WP after post update/create

I would like to run a filter on post content after it has been created or updated. I would like this to occur after the user has submitted the post, as it may be a bit of a lengthy process (a ...
1
vote
1answer
113 views

WP_Cron script not updating all posts in loop

I've had an issue with this piece of script for a month now http://pastebin.com/f6LqgqQS. What the script is supposed to do is loop through all my posts, pull the like count from the facebook graph ...