I'm running WordPress 3.6, multisite. I have a plugin activated with this content (it's been simplified):
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' );
Every day, a new blog with an ID of 2 is registered and every day I would like to remove it but I'm getting the following error:
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
I'm wondering why this might be happening?
When I'm calling do_action( 'delete_user_daily' );
manually, it works...