WordPress Date Change Redirects

WordPress has properly redirected posts when you change the slug for a long time. For example, earlier this month I published a post a day earlier than planned. I forgot to change the date I was using in the post’s title though, so the original URL was:


Notice link-dump-2018-01-05 there, but the publish date was 2018/01/04. When I corrected the post’s title and updated the post slug, WordPress saved the info and properly redirected that URL to the new one:


Now imagine the date a post is published is important to your site though or some scenario where you change the date of a post after it’s already out there on the Internet. My example above is a little confusing for this since I’m also using a date in the post title. Continuing with it though, what if I really wanted the post to be associated with January 5th as the publish date (and I had left the title the same as it was originally)? The post’s new URL would be:


Which is fine right? Not quite. All of the links already pointing to the original URL that had /2018/01/04/ would be broken and 404. There was a WordPress bug ticket opened about this 7 years ago! Well, as of yesterday, with the WordPress 4.9.3 Maintenance Release, this issue finally has a fix. When you change the date of a published post, WordPress will save meta data so it can properly redirect the old date’s URL to the new one. 💥💥

Big thanks to Gary for helping me with this fix. It’s been years since I received props in a WordPress release and I need to make sure the next isn’t so far away.

%d bloggers like this: