The tag has no wiki summary.

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'); ...
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: ...
7
votes
3answers
6k views

How to debug WordPress “Cron” wp_schedule_event

How can I debug problems with WordPress Cron? I think it will trigger when users go to your site but any errors wont be shown to them, as the jobs are run "asynchronously". So how might I debug ...
6
votes
2answers
804 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 ...
6
votes
3answers
533 views

Check if function called by cron job

I have a function that I only want to run via a cron job. Is there a way I can check that a particular scheduled event is calling this function and not anything else?
6
votes
1answer
700 views

Real automated and unattended wordpress upgrade including plugins

I'm looking for a truly automated way to upgrade wordpress and its plugins, something that i could put in the crontab and configure it to run daily. I have several wordpress plugins (>20) and a ...
5
votes
3answers
741 views

How do I log plugin (cron) actions?

Is there a recommended way to log (failed) cron actions from your plugin? For example, I have a plugin that synchronizes with an external service every hour. I want to log how much was changed, but ...
5
votes
1answer
1k views

Delete all scheduled events with a particular hook

I have several cron jobs all hooked to the same hook, but each with a different argument (a post ID). It appears wp_clear_scheduled_hook only clears job which match the argument passed with it (or ...
4
votes
1answer
371 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 ...
4
votes
3answers
735 views

Running WP Cron on specific local time

The scenario is to run insert_post function every midnight (00:00) of local time. Must run daily on weekday. function add_daily_task(){ if((date('l', time()) != 'Saturday') || (date('l', time()) ...
4
votes
1answer
85 views

Cron firing my function everytime wp-admin is visited

This is a MU-plugin I'm developing, and I want it to run hourly. Unfortunately, it's running every time I visit any site's wp-admin page. I've used the Debug Bar plugin with the Cron plugin, and it ...
3
votes
2answers
1k views

wp-cron.php - How are WP's Cron transients removed?

I have a Wordpress Network that I am tasked with disabling the WP Cron and replacing it with an Apache Cron. I have set up a PHP script that when called by an Apache Cron will loop through all sites ...
3
votes
2answers
3k views

Transient RSS feeds in wp_options not removed automatically?

I just noticed 55.000 entries(!) in my wp_options table. I had not been there for a while. So I ran: delete from `wp_options` where `option_name` like '_transient_timeout_rss%' delete from ...
3
votes
1answer
211 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
3answers
575 views

Refresh external feeds only in cron?

Is there an easy way to ensure that external feeds (via fetch_feed()) are only fetched via cron, and not when a regular user visits the site? This is for performance reasons, I want to minimize the ...
3
votes
1answer
362 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
278 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
337 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
241 views

Calling static method in the Widget Class

I have a widget class Xwidget extends WP_Widget{ function cron_addB(){} } I want to run a cron job that calls that function from outside the class function xxx_cron_activation() { ; if ( ...
2
votes
2answers
603 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
387 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
1answer
275 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
2answers
427 views

Cron jobs for deactivated plugins

Hi I am using a plugin to view the cron jobs that are run by wordpress. I am noticing that there are jobs related to plugins I have deactivated and even deleted. Why is this so and how can I remove ...
2
votes
1answer
358 views

Schedule cron event from widget

Can I use wp_schedule_event() to set up a cron job from within a widget? I tried, but I can't make it work, The problem seems to be the $hook parameter. The function I'm trying to hook is located ...
2
votes
1answer
228 views

Scheduled event does not run at midnight

I have an event scheduled to fetch feeds from different sources at midnight. I believe for some reason it is not being triggered. I use Core Control plugin for testing. When I 'Run Now' through it, ...
2
votes
2answers
656 views

Use Cron to modify posts via sql

Hi to all I need to run this twice a day: UPDATE wp_posts SET post_content = REPLACE ( post_content, '[img]', '<img src="' ); UPDATE wp_posts SET post_content = REPLACE ( post_content, '[IMG]', ...
2
votes
1answer
462 views

PHP5, Inheritance, Singleton - action & filter hook limitations

I'm currently working on a plugin, which uses the builtin cron functionality of wordpress. Instead of using PHP4, I want to use PHP5 with inheritance and the singleton design pattern. I run in some ...
2
votes
1answer
189 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
179 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
1answer
68 views

Will Wordpress use the newer schedule if it is updated using the filter 'cron_schedules'?

I learned that you can add new cron schedules by using the cron_schedules filter. If I change a interval of a schedule that I added earlier, will a job that uses this schedule be scheduled using this ...
2
votes
1answer
188 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
1answer
211 views

How do you load WordPress from an external script when using MultiSite? [duplicate]

Possible Duplicate: Using WordPress functions on other sites I have an external script that needs to load up WordPress in order to have access to WordPress functionality. In the past I ...
1
vote
2answers
1k views

Delete posts from a post type automatically via Cron

how can I use Cron to delete posts of a certain post type once they reach a certain limit, like keep maximum 50 posts? The reason is that these posts are being imported automatically periodically, so ...
1
vote
2answers
1k views

Sending out scheduled emails

Will wordpress run cron if I have scheduled emails to send? Seems like if no visit (request) is made to the site, scheduled tasks won't run and therefore emails won't be sent eg. hourly. According ...
1
vote
3answers
373 views

Transients vs CRON +Custom Fields: Caching Data Per Post

Wanted some opinions on a solution I'm trying to come up with: I have a fan/enthusiast plugin I'm working on for fans of TV shows. One of the custom post types attached to the plugin is a release ...
1
vote
1answer
464 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
2answers
90 views

Template Tag not available in real Cron Jobs

I have very simple file with one line: echo file_get_contents( get_template_directory_uri().'/scheduler.php' ); This file is called by cpanel cron using php -q. When I put full link without ...
1
vote
2answers
355 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
5answers
1k views

Insert Wordpress page via external (cron) script?

I'm trying to write a php script that I can run out of cron to create new Wordpress pages. Unfortunately, I can't find any documentation on how to do this. I'm using the WP scripts rather than ...
1
vote
1answer
103 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
527 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
176 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
1answer
2k views

Create cron job without a plugin?

Basically I wrote a function that lets me change the post status to draft depending of a field in the postmeta table: /** * Remove ads if they have been sold for over 5 days */ function ...
1
vote
1answer
44 views

After plugin options changed hook

i am looking for a hook that fires after the options for my plugin have changed. I have an option named "interval", it basically registers a cron schedule. Now, id like the change to take effect, ...
1
vote
1answer
134 views

WP Super Cache All Pages [closed]

I didnt find it but is it possible to run at night all pages so the next morning the whole website is cached? Or are there other plugins who does this job? I hope someone can help me! Thanks!
1
vote
2answers
318 views

WP_cron won't trigger my action

I'm in a dead end with a schedualed task in a wordpress plugin for a multisite. Somehow the action I added don't get triggered. The task is getting schedualed and returns a timestamp when I run ...
1
vote
2answers
607 views

Auto Publish On Cron

I have some 100 unpublished posts. I want to publish 1 random post every time a cron is run. Is there a way or plugin to achieve this...
1
vote
1answer
126 views

WordPress Cron how to find out my event recurrence?

In my plugin I'm able to set a cron event like so: wp_schedule_event(time(), 'daily', 'myhookname'); But want I want to do is be able to find out what recurrence I have set for myhookname. The ...
1
vote
3answers
265 views

Plugin for automated upgrade of WordPress core and it's plugins?

Is it possible to get your WordPress site to upgrade itself automatically? What I mean is, when plugins etc. needs to be upgraded, can you just press a button, or have a cron job, download the new ...
1
vote
2answers
244 views

Force Cron to run only on one server

Given a site running on server A and server B with a load balancer, shared database/etc, and a regular wp-cron task, how would I make sure that wp-cron only runs on server A, never on server B?