Push to WordPress Workflow

Push to WordPress (v1.1): A major update to my publishing workflow. The update makes use of my new writing template — originally discussed in Launch Ulysses Workflow — to incorporate post metadata into the Ulysses sheet.

Push to WordPress (v1.1) no longer asks for the URL slug, tags, post type, and custom field content. Instead, that information is obtained by Workflow with regular expressions on the exported text. The update also skips the WordPress dashboard and asks for a publish date from within Workflow.

If you’re interested in learning more about this workflow’s update, I’ve written about the changes in its own article. And if you’re interested in the original, links to that version and my initial write-up, explaining the thought process behind it, will remain below.

—July 7, 2016


For as long as the iPhone has existed, some portion of my writing took place on iOS, but it’s never been as easy as it is now. A few weeks ago, I shared the workflow I use to kickstart link publishing on Initial Charge. I’ve used it almost everyday for about a month and it continues to amaze me each time.

Between Workflow and Ulysses, my writing process has been greatly streamlined and the amount of time I’ve saved is beginning to add up. It may seem like just a few minutes here and there, but that’s slowly turned into a few extra hours that I can allocate elsewhere. There’s been multiple instances over the past week in which I’ve emptied all of my inboxes — Instapaper, Overcast, Reeder, Tweetbot, and Dispatch. Doing so before I started using Ulysses and Workflow was a rarity, but now it’s becoming commonplace and I’m starting to enjoy these unexpected breaks.

Workflow has done the majority of the heavy-lifting for me in that regard. Many of the tasks which used to require multiple steps and a lot of tapping can be performed in the action sheet. Since the last time I’ve written about the app I’ve built workflows for searching Initial Charge, converting text to title case, and displaying the word count of selected text on a web page. This is stuff I do a handful of times each week that are now much quicker to perform, thanks to Workflow.

But the workflow that’s made the largest impact has been Push to WordPress. As I’ve discussed previously, I used to use WordPress’ Press This bookmarklet for composing links, relying on a combination of CF Setter and Slugger+ for setting custom fields and URL slugs. For writing feature articles, I would start in Simplenote and eventually copy and paste into the WordPress dashboard when I was nearing a final draft.

This process was inefficient, at best, and has been supplanted by a more modern workflow that allows me to write entirely in Ulysses, regardless of what form that published work will take. This means I’ll have a familiar writing environment for everything I publish — going all-in on Markdown and building efficiencies from its consistency. It will also let me keep an archive of my writing in iCloud — accessible from Ulysses on all of my devices.

It’s worth mentioning that The Soulmen have announced that Ulysses will soon have native support for publishing to WordPress. I was initially worried that this would render my publishing workflow useless, but I’ve realized that there’s still a reason for its existence. Ulysses’ publishing mechanism might not have support for the features that I need if I’m going to use it full time. Support for custom fields, scheduled publishing, and custom URL slugs are all essential to me, but there’s no telling if they’ll exist at launch. And more importantly, we don’t know when the update will be released — I need to publish now.

The Workflow

This is, by far, the most complicated workflow I’ve ever built. But I’d be remiss if I didn’t credit Federico Viticci’s publishing workflow as an inspiration for my own. I originally designed two separate workflows — one for publishing links and another for publishing features articles. That is, until I came across Viticci’s. His asks which post type you’re publishing and performs a different set of actions based on the one you choose. This was a brilliant idea and allowed me to simplify Workflow’s action sheet without losing any functionality.

The workflow uses a few regular expressions to interact with text on the first and last line of the document. I wish I had the ability to write my own regular expressions, but it’s a little over my head at this point. I did manage to find the ones I needed in a Reddit thread and on Stephen Millard’s Thought Asylum. Without these, the workflow just wouldn’t be possible.

There’s several pieces of information that I needed to populate in the “Post to WordPress” action in Workflow — title, custom fields, post content, category, tags, and URL slug. The title, custom fields, and post content are saved as variables using the aforementioned regular expressions before being passed to the publishing action. The category is automatically set based on which post type is chosen at the beginning of the Workflow — Linked List or Feature.

Unfortunately, the current workflow asks for the URL slug and tags when it’s triggered. I would prefer those bits of information be automatically populated, but it wasn’t until a few days ago that I devised a way to do so. It’s all theory at this point — completely untested — but I hope I’ll be able to integrate it soon. The largest benefit to adding this feature is that both tags and URL slugs would be saved in Ulysses rather than only existing inside my WordPress database.

Push to WordPress is activated from the “Run Workflow” action extension, when viewing Ulysses’ export screen, and performs the following process:

  • The entire document is saved as the variable “Note,” the first line is capitalized with title case, and saved as the variable “Title.”
  • A menu appears asking whether your publishing a link or a feature article.
  • If Linked List is chosen:
    • The first line — title — and last line — URL — are stripped from the document and the result is saved as the variable “Content”.
    • Workflow asks you to choose which URL you’d like placed in the custom field.
    • The post content, title, and custom field URL are passed to the “Post to WordPress” action and Workflow asks for the URL slug and tags.
    • The post is saved as a draft in your WordPress Dashboard which is then opened in Safari.
  • If Feature is chosen:
    • The top line — title — is stripped from the document and passed to the “Post to WordPress” action.
    • Workflow asks for the URL slug and tags.
    • The post is saved as a draft in your WordPress Dashboard which is then opened in Safari.

I’ve only tested this Workflow in Ulysses, exporting HTML snippets — it does not work if you’re trying to export “full page”. I expect it will work with other text editors as well, as long as they’re able to export HTML. But there are a few more things to remember about the workflow:

  • Push to WordPress always assumes that the title is on the first line — if anything else is on the first line, it will be stripped from the post content and treated as the title.
  • If Linked List is chosen as the post type, the workflow assumes that the last line is the contents of your custom field.
  • The workflow doesn’t actually publish the post, it only saves it as a draft. That way it can be previewed in the site’s design and scheduled to publish at a later date — most of what I publish is written a day or two before it goes live.

While it’s unlikely that anyone has the same setup as I do for publishing, I suspect there are plenty with similar needs. With that in mind, I think Push to WordPress is a perfect starting point for anyone who wants to hack together their own publishing workflow.