Can anyone confirm whether @nahumck’s Link Post to WordPress w/ Preview | Drafts Directory action still works properly? I’ve been trying to use it, but the [[categories]] and [[link]] references don’t actually post the categories or link to Wordpress. [[tags]] actually works just fine, and it does fetch the categories from Wordpress, but it just posts the text “[[categories]]” for the category, no matter what I select, and it posts the text “[[link]]” to the “externalLink” custom field.
Can’t figure out if there’s something I’m doing wrong or if Drafts is being buggy, or if the script is out of date or something.
I’m running the script entirely unchanged from default, and have logged into Wordpress through Drafts with my credentials.
If you are able to get it to work, can you share a sample draft that you’ve confirmed will work with the action?
If you look in the action log after running, you’ll get a clue from the message “Draft.setTemplateTag: Invalid tag name and value strings”.
The script in this action invalidly tries to set template tags for the values of the custom template tags using arrays of values, and that function only accepts string values.
This can be fixed pretty easily. There are three places to fix, look for the following and make the replacements and it should work:
// at end of second script replace this:
draft.setTemplateTag("link",link)
// with the follow (addition is the .join
draft.setTemplateTag("link",link.join(","))
Add the same .join(",") in the setTemplateTag calls for the “categories” and “tags” tags in the third script.
That should make it work properly.
(I’ll tag @nahumck to see if he wants to post an updated version of the action)
I mistakenly deleted the action from my install, so I don’t have a way to update it. That said, I reinstalled from the directory, modified it, and created a new action in the directory.
Please delete the old one. Hope this works! I don’t use Wordpress anymore, so I have no way of testing.