From 53dfdc063b5e8edae2e56533a493e452498d0d7d Mon Sep 17 00:00:00 2001 From: westi Date: Sat, 19 Dec 2009 11:47:16 +0000 Subject: [PATCH] Fix wp_clear_scheduled_hook() so that it function prototype matches the other cron functions. Include backwards compatibility code so that plugins that used the old way still work. Fixes #10468. git-svn-id: http://svn.automattic.com/wordpress/trunk@12462 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/cron.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wp-includes/cron.php b/wp-includes/cron.php index 416803a9b..b31e83565 100644 --- a/wp-includes/cron.php +++ b/wp-includes/cron.php @@ -130,10 +130,13 @@ function wp_unschedule_event( $timestamp, $hook, $args = array() ) { * @since 2.1.0 * * @param string $hook Action hook, the execution of which will be unscheduled. - * @param mixed $args,... Optional. Event arguments. + * @param array $args Optional. Arguments that were to be pass to the hook's callback function. */ -function wp_clear_scheduled_hook( $hook ) { - $args = array_slice( func_get_args(), 1 ); +function wp_clear_scheduled_hook( $hook, $args = array() ) { + // Backward compatibility + // Previously this function took the arguments as discrete vars rather than an array like the rest of the API + if ( !is_array($args) ) + $args = array_slice( func_get_args(), 1 ); while ( $timestamp = wp_next_scheduled( $hook, $args ) ) wp_unschedule_event( $timestamp, $hook, $args );