'ids', 'number' => 0 ) ); if ( ! empty( $site_ids ) && is_array( $site_ids ) ) { $original = get_current_blog_id(); foreach ( $site_ids as $blog_id ) { switch_to_blog( (int) $blog_id ); try { $delete_options( $keys ); } finally { restore_current_blog(); // ensure we always restore } } // Make sure we’re back on the original blog (paranoia). switch_to_blog( (int) $original ); restore_current_blog(); } } else { // Single site. $delete_options( $keys ); }