In the category “2-minute hacks for skilled people, 30-minute hacks for me because I can’t code for shit”, let’s replay an old RSS feed. Useful if you want to read the old posts on a blog but don’t want to do it all at once.
This way, you can relive the past of your favourite WordPress blogs. Requires a server with php installation and a feed reader that updates at least once per day. I’ve got a Raspberry Pi 3B running selfoss.
We’ll be using a fancy feature of Wordpess, namely that
https://example.com/yyyy/mm/dd/feed gives the RSS feed with posts from that day interval. Actually every public-facing WordPress page can be appended with
/feed to produce something meaningful. It will not be a truly faithful replay of old posts, because if posts get edited or deleted we won’t get to see the original post.
With this knowledge in mind, create a php file
$ touch public/delay.php $ chmod 755 public/delay.php
and fill it with the following code
<?php $url = htmlspecialchars($_GET['url']); $years = floatval($_GET['years']); $months = floatval($_GET['months']); $days = floatval($_GET['days']); // calculate the time stamp of some day in the past // (we subtract a fixed amount of seconds so that we dont // run into issues with how many days a month has and // because I am not good enough at coding to handle this // the right way.) $months_delayed = $months + 12 * $years; $days_delayed = $days + 30 * $months_delayed; $moment = time() - intval(60 * 60 * 24 * $days_delayed); // redirect to the RSS file with posts from that day header('Location: ' . $url . '/' . date('Y/m/d', $moment) . '/feed', 303); die(); ?>
Requesting the page
http://example.org/delay.php?url=https://bethzero.com/feed&months=1 will redirect you to an RSS file containing all posts made exactly 30 days ago. Because we’re using a temporary 303 redirect, the page that you get redirected to changes every day. If your feed reader updates every day, you should get to see every post.
One small issue happens if a day has more blog posts than can appear in the RSS feed (default is 10 in WordPress). In that case, you might miss out on the oldest posts of the day.