WP3.6:PHP致命错误:调用未定义的函数wpmuDelete_User()

时间:2013-08-26 作者:Paul

我正在运行WordPress 3.6,多站点。我有一个激活了此内容的插件(已简化):

function prefix_delete_user() {
    $some_option = get_site_option( \'some_option\' ); // at this point it works
    wpmu_delete_user( 2 ); // at this point it doesn\'t
    return;
}
add_action( \'delete_user_daily\', \'prefix_delete_user\' );

function setup_schedule() {
    if ( ! wp_next_scheduled( \'delete_user_daily\' ) ) {
        wp_schedule_event( time(), \'daily\', \'delete_user_daily\');
    }
}
add_action( \'wp\', \'setup_schedule\' );
每天都会注册一个ID为2的新博客,每天我都想删除它,但我遇到以下错误:

PHP Fatal error: Call to undefined function wpmu_delete_user() in /home/example/ftp/example.com/wp-content/plugins/expiration/expiration.php on line 96
我想知道为什么会这样?

当我打电话的时候do_action( \'delete_user_daily\' ); 手动,它可以工作。。。

1 个回复
SO网友:Eugene Manuilov

看起来像ms.php 未为cron作业加载文件。尝试在插件的开头添加以下行:

require_once ABSPATH . \'wp-admin/includes/ms.php\';

结束