Semi-Automate Tag Links on WordPress
After switching from Squarespace to WordPress I found some small challenges. One of them is linking tags withing a Page or Post. Its quite tedious. You would normally have to:
- Mark the Text to Link
- Copy Text to search for Tags
- Hit CTRL+K or the link icon
- Paste and Search for the correct link through pages of results…
- Confirm the whole thing.
Urgs… so let’s speed that up with AHK! 😀
What is AutoHotkey (AHK)?
There is a cool program called AutoHotkey. Its a tool that let’s you create a scripts which will do what we want. You can do many things with AutoHotkey or AHK. Like using hot-string, so if you type “kr,” it could automatically transform that to “Kind Regards,” or whatever you want.
Semi Automatic Tag Linking
; this is our keyboard combination. ^ = Ctrl and ! = Alt and v = v :D
^!v::
; copy clipboard
clip := trim(clipboard)
; remove chars I don't want to have
clip := StrReplace(clip, " ", "-")
clip := StrReplace(clip, "'", "-")
; setup link
link := "/blog/tag/" . clip
stringlower, link, link
; enter link menu
Send ^{k}
sleep, 50
; post link and confirm
send, % link
sleep, 50
Send {enter}
; necessary to show that this command is finished
return
Paste the code into an “.ahk” file and start that. You’ll see a small green icon in your system tray. Lets test
Article of Protection
Turn into
Hehehe, nice. That will speed up the tag linking quite good.
Related Articles
If you want to read more about my Life here is list of interesting articles: