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
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...

1 Answer 1


Looks like ms.php file is not loaded for cron job. Try to add following line at the beginning of your plugin:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.