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
This commit is contained in:
westi 2009-12-19 11:47:16 +00:00
parent e51aa59549
commit 53dfdc063b
1 changed files with 6 additions and 3 deletions

View File

@ -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 );