Skip to main content
  1. All Posts/


Tools Open Source PHP WordPress

Flickr Export to WordPress Import


This tool will help you use the official Flickr account export to generate files that can then be imported into WordPress.
This is not a “one click” solution. It requires some manual configuration and general comfort with working on the command line. It may not work for your particular Flickr account or WordPress setup without some changes. It may not work at all.


I designed this tool to facilitate this basic approach:

  1. Download all photo files and metadata from Flickr.
  2. Use the downloaded information to construct a valid WXR import file and a valid WordPress uploads directory.
  3. Move the uploads directory in to place and import the WXR file in to WordPress.
  4. End up with a complete WordPress media library and set of posts, one for each Flickr image.

(The resulting site should have your photos, photo meta data, tags and comments. Some key meta values will also be archived in WordPress post meta for later use, e.g. if you want to find/replace references to Flickr URLs in content on another site to use your new WordPress URLs instead.)
This is probably not the best way to do this, but it was the right way for me.
Yes, there are an increasing number of tools that make use of the perfectly good Flickr API to access and download photos for use in other environments. In particular the Keyring Social Importers plugin is a pretty robust way to bring in existing and new Flickr content to WordPress via the Flickr API.

Requirements and Limitations

For this tool to be useful to you, you’ll need:

  • Access to your Flickr account, where you should initiate a request to make a full export of all your Flickr data available, and then download all of the resulting zip files for both the “Account Data” and for the “Photos and Videos”.
  • A Flickr API key (if you want to include commenter names in your WordPress site)
  • A local command line environment with PHP installed, the jhead image manipulation tool, and enough disk space to work with an extracted archive of your Flickr photos, and possibly two copies of that data. I did all this on macOS. (You can get a good idea of how much space that is by going to “You -> Stats” on Flickr and seeing what it says you’re using there.)
  • A fresh install of WordPress where you have the ability to run WP CLI commands and to directly upload (probably via SFTP) and manipulate files on the local filesystem.
  • A little patience, as there are a number of steps involved.

There are some known limitations with this tool:

  • No support for migrating videos or other non-JPG files. Nothing technical preventing this, I just didn’t bother yet. The script will output a list of files that need to be handled manually.

Image Rotation Note

The jhead image manipulation tool is listed as a requirement because I could not find an easy way to get Flickr’s interaction with image orientation data to reliably translate into WordPress’s interaction with image orientation data. The end result was images that were rotated on their sides or upside down.
The easiest solution I could find was to do a one-time fix on the source image files themselves before beginning to import them in to WordPress.
If you’re on a Mac and using Brew, setup should be as easy as brew install jhead.
See instructions below for actual image rotation commands.
You may also wish to consider installing the Fix Image Rotation plugin or similar on your site for future photo uploads; there are still known issues with how rotated images shared from (for example) iOS devices are handled in WordPress.

Installing and Using

Generating the WordPress Import

  1. Create a working directory for this effort somewhere in your local environment and cd to it.
  2. Clone this repo using git clone
  3. Move your zip files downloaded from Flickr in to the working directory and extract them. Leave the photo file directories named as they are (e.g. data-download-1) but rename the directory containing the meta data (one JSON file per photo, among other things) to a sub-directory called just meta.
  4. Create a few more output sub-directories: mkdir wxr uploads;
  5. In the config/ directory, copy example-config.php to config.php and edit the file to fill in the variables defined there.
  6. So, now your directory structure should look something like:

  7. Do a one-time rotation of any images needing it. Find the highest numbered data directory containing image files, and then execute this shell command replacing 4 with that highest number:
    for i in {1..4}; do jhead -autorot data-download-$i/*.jpg; done.
  8. Run the import generation script: php...