Docs / Troubleshooting / Migration Guide

Migration Guide

Overview

This guide covers migrating WordPress Download Manager between servers, upgrading from older versions, and transitioning from other download management plugins. Follow these steps to ensure a smooth migration with no data loss.

Migration Types

Type Complexity Time Required
Same server, new directory Low 15-30 minutes
New server, same host Medium 1-2 hours
New server, new host Medium 2-4 hours
Major version upgrade Low 30 minutes
From other plugins High 4-8 hours

Pre-Migration Checklist

Before starting any migration:

□ Backup entire WordPress installation
□ Backup database (full export)
□ Document current WPDM version
□ List all installed add-ons
□ Export license keys
□ Note custom template modifications
□ Download files from cloud storage (if applicable)
□ Disable caching plugins
□ Enable maintenance mode

Server-to-Server Migration

Step 1: Backup Current Installation

Full site backup:

# Create backup directory
mkdir ~/wpdm-backup-$(date +%Y%m%d)
cd ~/wpdm-backup-$(date +%Y%m%d)

# Backup WordPress files
tar -czf wordpress-files.tar.gz /path/to/wordpress/

# Backup database
mysqldump -u username -p database_name > database-backup.sql

# Backup uploads specifically
tar -czf download-files.tar.gz /path/to/wp-content/uploads/download-manager-files/

Using WP-CLI:

# Export database
wp db export wpdm-backup.sql

# Create package list
wp post list --post_type=wpdmpro --format=csv > packages-list.csv

Step 2: Transfer Files

Using rsync (recommended):

# Transfer entire WordPress
rsync -avz --progress /path/to/wordpress/ user@newserver:/path/to/wordpress/

# Transfer only WPDM files
rsync -avz --progress 
  /path/to/wp-content/uploads/download-manager-files/ 
  user@newserver:/path/to/wp-content/uploads/download-manager-files/

Using SFTP:

Priority files to transfer:
1. wp-content/uploads/download-manager-files/   (all download files)
2. wp-content/plugins/download-manager/         (if modified)
3. wp-content/plugins/wpdm-*/                   (all add-ons)
4. wp-content/themes/your-theme/download-manager/ (template overrides)

Step 3: Migrate Database

Export from old server:

-- Export only WPDM tables
mysqldump -u user -p database_name 
  wp_ahm_download_stats 
  wp_ahm_emails 
  wp_ahm_sessions 
  wp_ahm_orders 
  wp_ahm_order_items 
  wp_ahm_coupons 
  wp_ahm_licenses 
  > wpdm-tables.sql

-- Export packages (posts + meta)
mysqldump -u user -p database_name wp_posts wp_postmeta 
  --where="post_type='wpdmpro'" 
  > wpdm-packages.sql

Import on new server:

# Import full database
mysql -u user -p database_name < database-backup.sql

# Or import WPDM tables only
mysql -u user -p database_name < wpdm-tables.sql
mysql -u user -p database_name < wpdm-packages.sql

Step 4: Update Configuration

Update wp-config.php:

// Update database credentials
define('DB_NAME', 'new_database');
define('DB_USER', 'new_user');
define('DB_PASSWORD', 'new_password');
define('DB_HOST', 'localhost');

// Update URLs if domain changed
define('WP_HOME', 'https://newdomain.com');
define('WP_SITEURL', 'https://newdomain.com');

Update URLs in database:

-- Update site URLs
UPDATE wp_options SET option_value = 'https://newdomain.com'
WHERE option_name IN ('siteurl', 'home');

-- Update file paths in package meta
UPDATE wp_postmeta
SET meta_value = REPLACE(meta_value, '/old/path/', '/new/path/')
WHERE meta_key = '__wpdm_files';

-- Update attachment URLs
UPDATE wp_postmeta
SET meta_value = REPLACE(meta_value, 'olddomain.com', 'newdomain.com')
WHERE meta_key LIKE '__wpdm_%';

Step 5: Verify Migration

# Check file permissions
find wp-content/uploads/download-manager-files -type f -exec chmod 644 {} ;
find wp-content/uploads/download-manager-files -type d -exec chmod 755 {} ;

# Verify file counts match
ls -la wp-content/uploads/download-manager-files/ | wc -l

Test checklist:

□ Admin can access Downloads menu
□ Package list shows all packages
□ File attachments are intact
□ Download links work
□ Statistics are preserved
□ Orders history is intact
□ License keys validate

Version Upgrades

Upgrading Major Versions

WPDM 6.x to 7.x:

  • Backup first:
   wp db export pre-upgrade-backup.sql
   
  • Check compatibility:

– WordPress 6.0+ required
– PHP 7.4+ required
– Review add-on compatibility

  • Update core plugin:
   wp plugin update download-manager
   
  • Update add-ons:
   wp plugin update --all
   
  • Run database migrations:
   Downloads → Settings → Advanced → Repair Database
   
  • Clear caches:
   wp cache flush
   wp transient delete --all
   

Database Schema Changes

WPDM 7.x new tables:

-- Check if new tables exist
SHOW TABLES LIKE 'wp_ahm_%';

-- Expected tables in 7.x:
-- wp_ahm_download_stats
-- wp_ahm_emails
-- wp_ahm_sessions
-- wp_ahm_orders
-- wp_ahm_order_items
-- wp_ahm_coupons
-- wp_ahm_licenses
-- wp_ahm_license_activations
-- wp_ahm_subscriptions

If tables are missing:

// Force table creation
// Add to wp-config.php temporarily
define('WPDM_FORCE_DB_UPDATE', true);

// Then visit any admin page
// Remove the define after tables are created

Meta Key Changes

WPDM 7.x updated meta keys:

Old Key New Key
__wpdm_download_count __wpdm_download_count (unchanged)
__wpdm_view_count __wpdm_view_count (unchanged)
_wpdm_package_dir __wpdm_package_dir
_wpdm_files __wpdm_files

Migration script:

// Run once to update meta keys
function migrate_wpdm_meta_keys() {
    global $wpdb;

    $old_keys = [
        '_wpdm_package_dir' => '__wpdm_package_dir',
        '_wpdm_files' => '__wpdm_files',
        '_wpdm_access' => '__wpdm_access',
    ];

    foreach ($old_keys as $old => $new) {
        $wpdb->update(
            $wpdb->postmeta,
            ['meta_key' => $new],
            ['meta_key' => $old]
        );
    }
}

Migrating from Other Plugins

From Easy Digital Downloads (EDD)

Step 1: Export EDD data

// Get all EDD downloads
$downloads = get_posts([
    'post_type' => 'download',
    'posts_per_page' => -1
]);

// Export to CSV for mapping
$csv = fopen('edd-exports.csv', 'w');
fputcsv($csv, ['ID', 'Title', 'Price', 'Files', 'Categories']);

foreach ($downloads as $download) {
    fputcsv($csv, [
        $download->ID,
        $download->post_title,
        edd_get_download_price($download->ID),
        json_encode(edd_get_download_files($download->ID)),
        json_encode(wp_get_object_terms($download->ID, 'download_category'))
    ]);
}
fclose($csv);

Step 2: Import to WPDM

function migrate_edd_to_wpdm() {
    $edd_downloads = get_posts([
        'post_type' => 'download',
        'posts_per_page' => -1
    ]);

    foreach ($edd_downloads as $edd) {
        // Create WPDM package
        $package_id = wp_insert_post([
            'post_type' => 'wpdmpro',
            'post_title' => $edd->post_title,
            'post_content' => $edd->post_content,
            'post_status' => 'publish'
        ]);

        // Migrate files
        $edd_files = edd_get_download_files($edd->ID);
        $wpdm_files = [];

        foreach ($edd_files as $file) {
            $wpdm_files[] = $file['file'];
        }

        update_post_meta($package_id, '__wpdm_files', $wpdm_files);

        // Migrate price (if using Premium Packages)
        $price = edd_get_download_price($edd->ID);
        if ($price > 0) {
            update_post_meta($package_id, '__wpdm_base_price', $price);
        }

        // Migrate categories
        $edd_cats = wp_get_object_terms($edd->ID, 'download_category');
        foreach ($edd_cats as $cat) {
            // Create WPDM category if doesn't exist
            $wpdm_cat = get_term_by('name', $cat->name, 'wpdmcategory');
            if (!$wpdm_cat) {
                $wpdm_cat = wp_insert_term($cat->name, 'wpdmcategory');
            }
            wp_set_object_terms($package_id, $wpdm_cat->term_id, 'wpdmcategory', true);
        }

        // Log migration
        error_log("Migrated EDD #{$edd->ID} to WPDM #{$package_id}");
    }
}

Step 3: Migrate orders

function migrate_edd_orders_to_wpdm() {
    global $wpdb;

    $edd_orders = edd_get_payments([
        'number' => -1,
        'status' => 'publish'
    ]);

    foreach ($edd_orders as $order) {
        $order_data = [
            'order_id' => 'EDD-' . $order->ID,
            'uid' => $order->user_id,
            'total' => $order->total,
            'order_status' => 'Completed',
            'payment_method' => $order->gateway,
            'date' => $order->date,
            'customer' => json_encode([
                'email' => $order->email,
                'name' => $order->first_name . ' ' . $order->last_name
            ])
        ];

        $wpdb->insert($wpdb->prefix . 'ahm_orders', $order_data);
    }
}

From WooCommerce Downloads

function migrate_woo_downloads_to_wpdm() {
    // Get downloadable products
    $products = wc_get_products([
        'downloadable' => true,
        'limit' => -1
    ]);

    foreach ($products as $product) {
        // Create WPDM package
        $package_id = wp_insert_post([
            'post_type' => 'wpdmpro',
            'post_title' => $product->get_name(),
            'post_content' => $product->get_description(),
            'post_status' => 'publish'
        ]);

        // Migrate downloadable files
        $downloads = $product->get_downloads();
        $wpdm_files = [];

        foreach ($downloads as $download) {
            $wpdm_files[] = $download->get_file();
        }

        update_post_meta($package_id, '__wpdm_files', $wpdm_files);

        // Migrate price
        update_post_meta($package_id, '__wpdm_base_price', $product->get_price());

        // Migrate thumbnail
        $thumbnail_id = $product->get_image_id();
        if ($thumbnail_id) {
            set_post_thumbnail($package_id, $thumbnail_id);
        }

        // Map old product to new package (for redirects)
        update_post_meta($package_id, '_migrated_from_woo', $product->get_id());
    }
}

From Simple Download Monitor

function migrate_sdm_to_wpdm() {
    $sdm_downloads = get_posts([
        'post_type' => 'sdm_downloads',
        'posts_per_page' => -1
    ]);

    foreach ($sdm_downloads as $sdm) {
        // Create WPDM package
        $package_id = wp_insert_post([
            'post_type' => 'wpdmpro',
            'post_title' => $sdm->post_title,
            'post_content' => $sdm->post_content,
            'post_status' => 'publish'
        ]);

        // Migrate file
        $file_url = get_post_meta($sdm->ID, 'sdm_upload', true);
        update_post_meta($package_id, '__wpdm_files', [$file_url]);

        // Migrate download count
        $count = get_post_meta($sdm->ID, 'sdm_count_offset', true);
        update_post_meta($package_id, '__wpdm_download_count', intval($count));

        // Migrate thumbnail
        $thumb = get_post_meta($sdm->ID, 'sdm_upload_thumbnail', true);
        if ($thumb) {
            update_post_meta($package_id, '__wpdm_preview_image', $thumb);
        }
    }
}

URL Redirects

Setting Up Redirects

After migration, set up redirects to preserve SEO:

.htaccess redirects:

# Redirect old EDD URLs to WPDM
RedirectMatch 301 ^/downloads/(.*)$ /download/$1

# Redirect old WooCommerce product URLs
RedirectMatch 301 ^/product/(.*)$ /download/$1

# Redirect old SDM URLs
RedirectMatch 301 ^/sdm_downloads/(.*)$ /download/$1

PHP redirects:

// Add to functions.php
add_action('template_redirect', function() {
    // Redirect old download URLs
    if (is_singular('download')) { // EDD post type
        $new_url = get_wpdm_package_url_by_title(get_the_title());
        if ($new_url) {
            wp_redirect($new_url, 301);
            exit;
        }
    }
});

Redirect Mapping

Create a redirect map for important URLs:

// Store redirect mapping
$redirects = [
    '/old-download/file-1/' => '/download/file-1/',
    '/product/software-pack/' => '/download/software-pack/',
];

// Implement redirects
add_action('init', function() use ($redirects) {
    $request = $_SERVER['REQUEST_URI'];

    if (isset($redirects[$request])) {
        wp_redirect(home_url($redirects[$request]), 301);
        exit;
    }
});

Cloud Storage Migration

Migrating S3 Buckets

Export bucket contents:

# List all files
aws s3 ls s3://old-bucket/ --recursive > file-list.txt

# Sync to new bucket
aws s3 sync s3://old-bucket/ s3://new-bucket/

Update WPDM settings:

Downloads → Settings → Amazon S3

Old Bucket: old-bucket-name
New Bucket: new-bucket-name

Update file references:

-- Update S3 paths in package meta
UPDATE wp_postmeta
SET meta_value = REPLACE(meta_value, 's3://old-bucket/', 's3://new-bucket/')
WHERE meta_key = '__wpdm_files';

Migrating Google Drive

  • Share new Google account with old account
  • Transfer ownership of files
  • Update OAuth credentials in WPDM settings
  • Re-authorize connection

Post-Migration Tasks

Verification Checklist

□ All packages visible in admin
□ File attachments working
□ Download counts preserved
□ Orders history intact
□ Licenses validated
□ Payment gateways configured
□ Email templates working
□ Shortcodes rendering
□ Template overrides active
□ Add-ons functional

Performance Optimization

After migration, optimize:

# Regenerate thumbnails
wp media regenerate --yes

# Flush rewrite rules
wp rewrite flush

# Clear all caches
wp cache flush
wp transient delete --all

SEO Considerations

  • Submit updated sitemap to search engines
  • Monitor 404 errors in Search Console
  • Set up redirect monitoring
  • Update internal links in content

Rollback Procedure

If migration fails:

# Restore database
mysql -u user -p database_name < pre-migration-backup.sql

# Restore files
tar -xzf wordpress-backup.tar.gz -C /path/to/wordpress/

# Clear caches
wp cache flush

# Verify restoration
wp plugin list

Getting Help

If you encounter issues:

  • Check error logs: wp-content/debug.log
  • Review WPDM migration logs
  • Contact support with:

– Source/destination server details
– WordPress/WPDM versions
– Error messages
– Steps taken


Related Documentation


Last updated: January 2026
Applies to: WordPress Download Manager 7.x

Last updated on January 26, 2026

Need Help?

Get support from our team or community forum.

Visit Support

Customization

Need custom features? We can help.

Request Quote