wp_schedule_event [ WordPress Function ]
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Schedule a periodic event.
Schedules a hook which will be executed by the WordPress actions core on a specific interval, specified by you. The action will trigger when someone visits your WordPress site, if the scheduled time has passed.
Valid values for the recurrence are hourly, daily and twicedaily. These can be extended using the cron_schedules filter in wp_get_schedules().
Use wp_next_scheduled() to prevent duplicates
Source
<?php
function wp_schedule_event( $timestamp, $recurrence, $hook, $args = array()) {
$crons = _get_cron_array();
$schedules = wp_get_schedules();
if ( !isset( $schedules[$recurrence] ) )
return false;
$event = (object) array( 'hook' => $hook, 'timestamp' => $timestamp, 'schedule' => $recurrence, 'args' => $args, 'interval' => $schedules[$recurrence]['interval'] );
$event = apply_filters('schedule_event', $event);
// A plugin disallowed this event
if ( ! $event )
return false;
$key = md5(serialize($event->args));
$crons[$event->timestamp][$event->hook][$key] = array( 'schedule' => $event->schedule, 'args' => $event->args, 'interval' => $event->interval );
uksort( $crons, "strnatcasecmp" );
_set_cron_array( $crons );
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- Function Reference/wp schedule event « WordPress Codex
Description. Schedules a hook which will be executed by the WordPress actions core on a specific interval, specified by you. The action will trigger when ...
codex.wordpress.org - WordPress › Support » Tags — wp_schedule_event
(forgot?) Register · WordPress › Support » wp_schedule_event ...
wordpress.org - Timing is everything: scheduling in WordPress | Development on a ...
Feb 1, 2007 ... wp_schedule_event( $timestamp, $recurrence, $hook, $args ) ... As mentioned wp_schedule_event can also take an optional fourth parameter ...
blog.slaven.net.au - wp cron - wp_schedule_event will it run if timestamp has passed ...
Feb 3, 2011 ... 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 ...
wordpress.stackexchange.com
Gebruikersdiscussies [ wordpress.org ]
- caevan on "wp_get_schedules not returning an array of schedules"
- Brian Layman on "wp_next_scheduled() returns timestamp, not scheduled time"
- dc5ala on "wp_schedule_event / cron_schedules - custom recurrence time not working in Plugi"
- dc5ala on "wp_schedule_event / cron_schedules - custom recurrence time not working in Plugi"
- juanfra on "wp_schedule_event problem when using functions."
- VFHwebdev on "wp_schedule_event twicedaily question"
- matt_price on "wp_next_scheduled() returns null but wp_options 'cron' shows my event"
- PapyRef on "wp_schedule_event / cron_schedules - custom recurrence time not working in Plugi"
- andriuss on "wp_schedule_event"
- SwansonPhotos on "How do I schedule a weekly cron event?"