Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




wp_reschedule_event [ WordPress Function ]

wp_reschedule_event ( $timestamp, $recurrence, $hook, $args = array() )
Parameters:
  • (int) $timestamp Timestamp for when to run the event.
  • (string) $recurrence How often the event should recur.
  • (string) $hook Action hook to execute when cron is run.
  • (array) $args Optional. Arguments to pass to the hook's callback function.
Returns:
  • (bool|null) False on failure. Null when event is rescheduled.
Defined at:



Reschedule a recurring event.

Source


<?php
function wp_reschedule_event$timestamp$recurrence$hook$args = array()) {
    
$crons _get_cron_array();
    
$schedules wp_get_schedules();
    
$key md5(serialize($args));
    
$interval 0;

    
// First we try to get it from the schedule
    
if ( == $interval )
        
$interval $schedules[$recurrence]['interval'];
    
// Now we try to get it from the saved interval in case the schedule disappears
    
if ( == $interval )
        
$interval $crons[$timestamp][$hook][$key]['interval'];
    
// Now we assume something is wrong and fail to schedule
    
if ( == $interval )
        return 
false;

    
$now time();

    if ( 
$timestamp >= $now )
        
$timestamp $now $interval;
    else
        
$timestamp $now + ($interval - (($now $timestamp) % $interval));

    
wp_schedule_event$timestamp$recurrence$hook$args );
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

Gebruikersdiscussies [ wordpress.org ]

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics