Documentation

Media Files Addon

This addon allows you to push and pull your files in the Media Library between two WordPress installs.

Installing the Media Files Addon

To download the Media Files Addon, login to My Account and head to the Downloads section of your Licenses tab. Alternatively, you can install the addons directly from your WordPress Dashboard, by navigating to Tools -> Migrate DB Pro -> Addons and click Install under “Media Files”.

Include Media Files in a Migration

During a push or pull migration, you are able to choose between migrating all media files, only new or updated media files, or new and updated media files from a specific date.

WP Migrate DB Pro media files options.

Migrate All Files

Whenever you create a new migration, you will probably want to copy the whole Media Library from one site to another. This option makes that a breeze. The addon will copy over all files from the source site to the destination site. All files in the source uploads folder will be copied to the destination, whether they exist at the destination or not.

Migrate New and Updated Media Files

This option is ideal if you are running a migration from a previously saved profile. Selecting it will migrate any new files or any files that have been modified since the last migration.

Migrate Media Files by Date

The media files by date option provides greater flexibility by giving you the option to specify a date/time by which to filter the media files to be migrated.

Media files by date.

The date shown on the screen will default to the last time the migration was run (in the case of a saved migrated profile) or simply the current date. Clicking on the date field presents you with a date/time select tool, where you can choose a specific date/time.

Media files date/time select tool.

Multisite

If you are migrating to or from a multisite installation, the media files will be transferred depending on what you are migrating.

If you are migrating from multisite to multisite then the options you select for transferring Media Files would apply to all media files in the entire multisite network. If you are migrating a subsite, either from or to a multisite, then this would apply just to the subsite.

WP-CLI

The addon integrates seamlessly with our CLI addon that lets you leverage the power of WP-CLI for performing migrations from the command line. When running existing profiles from the CLI, you now get a more informative display of the media migrations process:

new-in-mf-13-and-cli-11-05

If you run CLI migrations on the fly with migration parameters you can use the --media parameter to specify the various options. You can read more about those options here.

Things to Remember

Migrations which skip the comparison and remove all files from the target site before migrating files from the source will also remove files that are not part of the target site’s Media Library but reside within the /wp-content/uploads folder. This can include files created by other plugins and any that have been manually uploaded.

Only files listed in your WordPress Media Library will be migrated. The addon will not migrate any files in your uploads folder that are not listed in the Media Library.

If you are selecting only certain tables as part of the database migration, and you intend to migrate media, you will need to include the ‘wp_posts’ and ‘wp_postmeta’ tables in the migration.

Permissions

To ensure media migrations are successful, make sure that your uploads folder is writable. Depending on your web host, you may need to set the permissions on your uploads folder and any subfolders to 775.

If any of the files fail to migrate you should be presented with a list of the failures upon migration completion. These are often non-fatal errors, meaning that the rest of the migration should have completed just fine.

Unicode-encoded Filenames & Windows

On Windows, the PHP filesystem wrapper expects and returns ISO-8859-1 strings for file/directory names. Non-ASCII characters will appear incorrect outside PHP. A non-ASCII UTF-8 char will be stored as multiple single ISO-8859-1 characters, e.g., ó will be appear as ó in Windows Explorer.

As it stands, you can’t load files with Unicode-encoded filenames into the WordPress media library and have them work on Windows. Similarly, WP Migrate DB Pro cannot migrate files which have Unicode-encoded filenames on Windows. Learn more about how Unicode works in this article.