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:

nick.blog/2018/01/04/link-dump-2018-01-05/

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:

nick.blog/2018/01/04/link-dump-2018-01-04/

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:

nick.blog/2018/01/05/link-dump-2018-01-05/

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.

Blog in a Box Paparazzi

wapi-512Happy Pi Day! I figured I better post something Raspberry Pi related today…

This weekend I played around with Blog in a Box which was recently released by our Tinker team at Automattic.

A quick and easy way of putting WordPress onto a Raspberry Pi.

BIAB ships with modules to use the Raspberry Pi camera and SenseHAT. I hadn’t used my Pi camera yet and had a fun idea to hack around with.

blog-in-a-box-ssh

The camera module allows you to take a photo on a schedule by setting a period of minutes, hours, or days between each photo. I wanted to have a little more fun, so I wired some other electronics up to a Raspberry Pi Zero and wrote a little Python program.

The first electronic element was a simple button. Press it and a picture is taken. Next up was a photocell (light sensor). When the room quickly changes from dark to light, it’ll take a picture. Since the Pi doesn’t have analog inputs, I went with a neat technique of measuring the sensor as a resistor used to ‘fill up’ a capacitor. The last element was an ultrasonic sensor I haven’t used yet either. It measures the distance to an object in front of it, so I’m kind of using it as a motion detector. Walk in front of the sensor and a picture is snapped. Due to mismatched voltages on the PI’s GPIO and the output signal of the rangefinder, I had to use some resistors to create a voltage divider circuit.

To create visual feedback I wired up an LED for each of these 3 components. When one of the components triggers a photo, the associated LED lights up until the process is complete.

I named it Blog in a Box Paparazzi. Of course the code and wiring info are available on GitHub. Should be easy to adjust if you have other sensors, buttons, switches, or whatever you want to trigger photos. Let me know if you try something different.

Streaking

daily-streak
I’ve been on a nice publishing streak here. It all started with a food post in Iceland. After a few days in a row I decided to keep it going. When I hit 14 days I was curious how it compared historically so I wrote a little script. The code is on GitHub. Here’s the output before publishing this post.

Posts published: 6,909 since 2003-11-22

Longest streak: 78 (2009-01-26 – 2009-04-13)
Longest slump: 90 (2007-01-01 – 2007-03-30)

Currently on a 41 day streak, since 2016-11-10. Post today to keep it going!

This post did keep it going, so the streak is up to 42 days. Can I break my record? I think so.

This renewed focus on blogging has helped to fuel some new hobbies. It’s also a reminder of how blogging changed my life years ago. I started programming PHP after setting up WordPress to run this site. Eventually I was creating plugins and contributing back to WordPress, which of course led to me getting hired at Automattic. Maybe blogging can pay off for you too.

With the rise of social media, many of you have become content creators, but almost nobody owns their own content. If Facebook, Twitter, or Instagram disappear what happens to all of your words, pictures, and videos? Probably gone. If you use your own domain and push content to other services, you’re in control.

Here, I control my words. Nobody can shut this site down, run annoying ads on it, or sell it to a phone company. Nobody can tell me what I can or can’t say, and I have complete control over the way it’s displayed.

– Andy Baio

Maybe you don’t care. If you do and would like to give blogging a try, head over to get.blog. Can you match my posting streak?

CrossFit & “The Blog”

I’ve pointed out similarities between the communities of CrossFit & WordPress before. Came across this video posted in 2011 of CrossFit’s founder, Greg Glassman, talking about blogging and their use of it on crossfit.com (known as “main site” in the community).

It seems like several times a year, we run into articles forecasting the death of blogging. Guess what… we keep seeing more and more activity. You can find all kinds of people and articles claiming “CrossFit is only a fad” or “the downfall is coming soon.” Guess what… the number of affiliate gyms around the world keeps increasing and the Open, now in year 6, has seen a 10x growth in participants.

A lot of CrossFit’s success can be attributed to the fact there has been a free workout posted on their blog every day since 2001. A lot of gyms and home gym athletes follow main site for workouts instead of doing their own programming.

If you’re running a business and you don’t have a blog, you’re missing out on a huge opportunity to connect with a lot of people and possibly create a community of your own. Not everyone uses Facebook, but everyone can visit your web site.

Matt Mullenweg on how open source is democratising the web

Darwin’s often misquoted — people say the strongest of the species survives, but it’s not actually what he said. He said the most agile, the most adaptive. So it’s not really about who’s the strongest or smartest or who has the most money, it’s who is going to adapt most quickly.

Matt Mullenweg on how open source is democratising the web