Migrate a copy of your Instagram archive to WordPress.
Before you can use this shortcut, you need to:
- Request a download of your Instagram data. Once you receive your archive, uncompress the ZIP file to the /Shortcuts directory in iCloud Drive.
Your Instagram data archive contains a copy of all uploaded photos and post information. The shortcut uses this data to upload your photos and publish them to your WordPress site. Each post contains the caption and any location information (if available). The date for the post also matches the original post date to Instagram.
You have the option to remove hashtags if you’d prefer not to include them in your micropost. Any usage of a 4- or 5-dot prefix (to separate the caption from a list of hashtags) is automatically removed.
Instagram provide all photo information in JSON format. When run for the first time, the shortcut performs the following actions:
- Creates a folder to store temporary information in
- Loops through media.json to get the dictionary values for every photo
- Saves all the photo information as separate JSON files to the temporary folder
Each temporary JSON file includes the following information:
- The caption
- Location (if available)
- Date uploaded
- The path to the photo file within the archive
Once the temporary files are created, the shortcut loops through each of them and performs the following steps:
- Removes any hashtags from the caption or converts them for use as tags (if required)
- Creates a new blog post containing the photo with the same date and caption information
- Deletes the temporary JSON file
The shortcut contains two dictionaries that includes some configuration options for you to change.
- instagram_archive_folder: the name of the folder containing your Instagram data archive
- temp_folder: the name of the temporary folder to use
- batch_size: the number of photos to migrate each time the shortcut is run
- publish_drafts: If true, new posts are saved as drafts instead of being published. If false, they are published immediately.
Instagram photo captions often contain hashtags. You can choose to keep them in the post, remove them, or convert them to tags.
To accommodate large Instagram migrations and allow users to check photos are importing correctly, the shortcut only publishes a specified number of photos (batch_size) at a time. For example, if you have 100 photos to import and set batch_size to 5, the shortcut imports 5 photos at a time—you must either run the shortcut repeatedly or increase the value of batch_size. This is especially useful if you would prefer to incrementally import your photos and don’t necessarily want to do them all at once, especially if you need to edit the posts afterwards.
If the shortcut migrates a batch of photos, it confirms how many have been published and how many times the shortcut needs to be run to migrate them all.
You can set batch_size to any value. If you’d prefer to import all photos at once, set it to a high number.
Resuming a migration
Information about each photo is saved as individual JSON files to a temporary folder. Once a photo has been imported, the corresponding JSON file is deleted. Each time the shortcut is run, it checks the temporary folder to see if there are still photos to import. If so, you can either continue importing the remaining photos or start over.
This prevent duplication of posts in the event the shortcut is stopped (e.g., Shortcuts crashes or the batch_size limit was reached). Since the JSON file is deleted when a photo is uploaded, the shortcut can pick up where it left of and continue migrate the remaining photos. This avoids any toilsome cleanup if a large migration fails.
Only if the temporary folder is empty or you select Start Over will the import start from the beginning.
Publish as drafts
You have the option of publishing draft microposts instead of publishing your photos immediately. This is useful if you would like to see how some of the migrated photos look before committing to a full migration. Set publish_drafts to true to import photos as draft posts or false to publish them immediately.
Considerations and known issues
Before you use this shortcut to migrate your Instagram photos to WordPress, please make sure you consider the following:
- Instagram doesn’t distinguish between captions, @mentions, or hashtags. This shortcut does its best to format captions and, if required, remove hashtags but it may not always be successful.
- iCloud Drive is required. If you prefer to use Dropbox, you’ll need to make changes to the shortcut.
- There’s a 45-second wait after saving the temporary files because iOS seems to need a little extra time to catch up and properly reflect the large number of file changes.
- Although all temporary files appear in iCloud Drive immediately, there is a delay before they’re actually available.
- If the shortcut produces an error along the lines of “the file xyz.jpg.json isn’t available”, run the shortcut again. It should work the next time.
- You should test a migration by uploading a batch of photos as draft posts.
- I recommend migrating photos in small batches to begin with. While you can upload many photos each time, batching them makes it easier if you have to make any changes.
- If you have a lot of photos, you may want to migrate them over a period or a few days rather than trying to do them all at once.
- Consider migrating all your photos to WordPress as drafts and then use the bulk options in WP Admin to change the status to Published. This allows you to check your posts and make any changes before they are public.