|

New Plug-in: Latest Post Redirect

One thing I often forget to do is update social links when I’m promoting a new blog post or podcast episode. Especially on Instagram, I’ll say something like, “link in the profile,”1 only to forget to add the link to the profile! Services like Linktree help a little, but you still need to update. Well over a couple of days, I built a plugin to help me (and hopefully you) with this little problem.

I Miss Coding

First, let me just tell you how much I miss coding on a regular basis. It’s so much fun to scratch an itch and solve a problem. And your code projects don’t need to be these huge feature-rich monoliths. One-off, super focused apps or plugins are all the rage these days! And that’s what I decided to do.

Introducing Latest Post Redirect

I created a simple plugin that accomplishes a single task:

Create a redirect called [YOUR-DOMAIN]/latest that redirects to the most recently published post.

That’s it. It’s 43 lines with comments and does 2 things:

  1. Checks the current URL to see if /latest or /latest/ is at the end of the URL
  2. If it is, get the permalink of the most recently published post and redirect the user to that link.

You can download the zip from Github

Live Streaming the Process

Over the last two weeks, I used my Live Stream to code it. The project took a little less than two hours for me to:

  1. Understand how redirects work in WordPress across different server types.
  2. Work out how to do a redirect the right way with WordPress
  3. Grab the latest post (the easiest part for me)
  4. Write a regular expression to check the link for exactly two cases: /latest or /latest/

If you’d like to see me built it out (and a glimpse into my brain when I code), you can watch both parts here:

Be sure to subscribe to my YouTube channel to catch the next live stream!

  1. When will Instagram finally let us add links to descriptions. Doesn’t even need to be comments. Just descriptions! ?

Similar Posts

  • The way to learn WordPress is not by contributing

    has happened in WordPress this year, and what we can expect moving forward. As always, he extolled the virtues of open source and the importance of contributing. He spent several minutes on Five for the Future, a program encouraging companies who make money with WordPress to give 5% of their time to the open source project. And while I strongly recommend contributing, I don’t think it’s the path someone should take when they first learn.

  • |

    CaboPress: The Business Conference I Needed

    When you tell people that you’re going to Cabo San Lucas for a business conference, you get some funny looks. Well, you get one specific look: “Oh sure. I bet you’ll do a ton of work there.” It’s easy to think. I mean, we are in paradise. Our sessions were in pools. We had afternoons…

  • |

    Sass, Sublime Text, Github, and Changing my Development Workflow

    When I left the full time freelancing world 2.5ish years ago, I had a very specific way I did things and I enjoyed it; however, admittedly, it wasn’t the best. I was using Coda, not making local copies, not using any form of version control, and my frameworks were becoming stale. I’ve been going to…

  • |

    11 Great Tools for Your WooCommerce Store

    I just got back from WordCamp Grand Rapids, and the theme of the camp was tools and services to make WordPress better. I spoke about some tools I use for Creator Courses, specifically revolving around the e-commerce portion. I also learned about some great WooCommerce tools from the attendees. I’d love to share some of…

  • |

    What is a Hackathon?

    According to Wikipedia, a hackathon is defined as: …an event in which computer programmers and others involved in software development, including graphic designers, interface designers and project managers, collaborate intensively on software projects. Basically, it’s a place were people who work with computers can come together to hopefully make something awesome. There are all types…

  • |

    Building Web Apps with WordPress

    I just finished reading up a book that was co-written by my friend Jason Coleman called Building Web Apps with WordPress. I picked it up because while I’m generally good at developing themes, I know there were some things I was missing- types of code, optimizations, plugin best practices, etc. I wanted to improve my WordPress…