Apple Shortcut to upload photos to WordPress Media Library

UPDATE 11 Feb 2023:

Good news! I refactored this to work with the Share Sheet and to prompt you for credentials and a media endpoint on the initial setup.

Here is the new link: https://www.icloud.com/shortcuts/cf31d94107e24e5e947a801fb9d8132c

Here is how easy it is to use on macOS.

And here is how easy it is to use on iOS:


Tonight I sat down and figured out something that has been in my head for months: Uploading photos to my WordPress Media Library with an Apple Shortcut. It works on both macOS and iOS.

I use the REST API to upload them to the /wp/v2/media endpoint via a POST request. For authentication I use a username and Application Password that I base64 encode.

Here is the basic workflow:

  • Select the photos
  • Loop through them and convert them to JPEGs. This is necessary because WordPress does not currently handle HEIC images, the default iOS image format.
  • Use a POST request to upload the converted JPEGs to the /wp/v2/media endpoint.

You currently have to run this from Shortcuts.app. Share sheet support does not work on macOS Monterey, so I still have the step in there to pick images from Photos.app. I know they added this in Ventura, but I haven’t upgraded yet. Once I do, I’ll change this to only take images from the Share sheet so you can start in Photos.app rather than Shortcuts. I know share sheet support works on iOS, but since I blog most on my Mac, I wanted to make a shortcut that works in both places.

If you’d like to use this Shortcut, you can get it here: https://www.icloud.com/shortcuts/e473f76d1692444896077ebcdbc4c893

If you use it, you’ll need to make two changes:

  1. In the Text area at the top, put your WordPress Username and Application Password in this format: username:password
    • Application passwords are found under wp-admin -> Users -> your user profile -> Application passwords
  2. Change the domain from example.com to your website’s domain.


Likes, Bookmarks, and Reposts

  • Jackson Bierfeldt
  • Chris Hardie
  • mitch@social.ridetrans.it
  • Meg Gilliland
  • Jackson Whelan

Comments

10 responses to “Apple Shortcut to upload photos to WordPress Media Library”

  1. @cagrimmett the sluggishness and number of steps getting photos from my mobile device to my WP media library has really been a deterrent to photo blogging for me. I’d tinkered with trying to make the mobile app do it better but never got very far. This looks like the missing piece! Thank you.

  2. Good news! I refactored this to work with the Share Sheet. Here is how easy it is to use on macOS.

  3. Good news! I refactored this to work with the Share Sheet. Here is how easy it is to use on macOS.

  4. And here is how easy it is to use on iOS:

  5. @ChrisHardie Check the original post – I refactored it to make it easier to use!

  6. Thank you very much . Greetings from Germany.

  7. […] Apple Shortcut to upload photos to WordPress Media Library […]

Leave a Reply

Webmentions

If you've written a response on your own site, you can enter that post's URL to reply with a Webmention.

The only requirement for your mention to be recognized is a link to this post in your post's content. You can update or delete your post and then re-submit the URL in the form to update or remove your response from this page.

Learn more about Webmentions.