Threads

WordPress auto-guesses posts from partial URL slugs

6 tweets · April 2021 · 9 likes · 0 retweets · read on Twitter

WHOA. Just accidentally discovered a gamechanging feature about WordPress. If you type a short url it automatically guesses which page or post you might be referring to based on the slug. I put in malcolmocean.com/ar and it took me to my archives page (normally /archives) 🧵

afaict from 2 experiments, this is using some sort of slug-starts-with logic (slug is the part of the post/page url that is human readable) eg this post is /a-laptop-employed-as-a-nightlight/ and  /a  /a-laptop redirect to it, but  /nightlight 404s malcolmocean.com/2015/11/a-lapt…

this is gamechanging because it means I can link to any of my posts, from memory, without needing to look up the url, as long as I know what the slug starts with (uniquely!) ...in particular, you don't need to know the date, also!

I manually made malcolmocean.com/grow redirect to this particular url, but as of now it LITERALLY ALREADY WOULD DO THAT since /grow is short for /growth-mindset-reframing (/gro works) (this likely wasn't true in 2014 when the post was published, fwiw) malcolmocean.com/2014/07/growth…

I tested this on another wordpress site I know that's not even running the latest wordpress (v5.0.12) and it also works there. I'm not the sort of creature who enjoys looking up exactly when this change was made or what it's called, but I'd be curious to know it if you 🐇 ⬇️ 🕳️

ohohoho this explains a thing I was confused about awhile ago which was that both /archive and /archives seemed to take me to my archives. I thought maybe that was some sort of special-case thing and didn't investigate deeply