Time Machine

Time Machine is a simple plugin that grab N published articles from database (posts and/or pages) published on current day and/or offset of time in past years, and list them in widget or block.

User can set widget title, number of displayed articles and message shown when there is no public articles in past.

Features

  • Shortcode, legacy widget, block-based widget and Gutenberg block, all with the same options
  • Set the number of articles to list
  • Set a custom message for days with no articles in the past, or hide the whole list when there is nothing to show
  • Include or exclude pages, and optionally exclude articles from the current year
  • Set offset and offset direction (before, after or both) with a time range in days, weeks or months
  • Optionally show an excerpt with a custom length; it is generated from post content when there is no manual excerpt
  • Optionally show the number of comments
  • Lists only published articles (drafts are never included)
  • Password protected articles are excluded unless you explicitly enable them; when included, the manual excerpt is used if there is one, otherwise no excerpt is generated from the content until the visitor unlocks the article (same as WordPress core)
  • Works with full page cache plugins: the list is refreshed after page load through a small REST endpoint (can be disabled with a constant in wp-config.php)
  • Site Health check warns you if a REST API restriction blocks that refresh, and tells you how to fix it
  • Cached queries that are cleared automatically whenever a post or page is saved
  • Clean, semantic HTML5 markup that validates without errors, styled by your theme’s CSS

Download

You can download the plugin below or from the official WordPress.org page for Time Machine while the development version can be found in the GitHub repository urosevic/time-machine

Installation

Getting started with Time Machine takes less than 2 minutes. Choose your preferred installation method below.

Quick start (Recommended)

  1. In your WordPress Dashboard, go to Plugins → Add New
  2. Search for time machine
  3. Click Install Now on the Time Machine plugin
  4. Click Activate
  5. Go to Appearance → Widgets to add legacy or Gutenberg widget, or to Appearance → Editor → Templates to add FSE block

That’s it! You’re ready to configure what your Time Machine is going to list.

Alternative installation methods

Manual upload via WordPress Dashboard

  1. Download the plugin from WordPress.org
  2. In WordPress Dashboard, go to Plugins → Add New
  3. Click Upload Plugin at the top
  4. Click Choose File and select the time-machine.zip file
  5. Click Install Now
  6. After installation completes, click Activate Plugin
  7. Navigate to Appearance → Widgets to add legacy or Gutenberg widget, or to Appearance → Editor → Templates to add FSE block

FTP/SFTP installation

For users with direct server access:

  1. Download time-machine.zip from WordPress.org
  2. Extract the archive on your local computer
  3. Connect to your server via FTP/SFTP
  4. Upload the entire time-machine folder to /wp-content/plugins/
  5. In WordPress Dashboard, go to Plugins → Installed Plugins
  6. Find Time Machine and click Activate
  7. Navigate to Appearance → Widgets to add legacy or Gutenberg widget, or to Appearance → Editor → Templates to add FSE block

WP-CLI installation

For developers using command line:

wp plugin install time-machine --activate

How To Use?

After activation on Plugins page, add widget via Appearance → Widgets or block via Appearance → Editor → Templates, proceed with widget/block configuration.

What is “Time range”?

By default, Time Machine will list only posts published on same month day in past years. But, you can set offset and force displaying posts published, for example, on same day and three days before (if today is October 10th, you’ll get posts published in range from October 7th to October 10th in previous years).

Frequently Asked Questions

Why name Time Machine?

I like effect that produce Time Machine – traveling trough time. This plugin does exactly that, but with fixed month and day constant.

How I can help?

Review and rate plugin, submit suggestions, contribute on WordPress forum.

Does Time Machine work with full page cache plugins (WP Rocket, WP Fastest Cache, W3 Total Cache…)?

Yes. Time Machine’s list is refetched from a small REST endpoint right after the page finishes loading, so the visible content stays current even when the whole page has been cached for longer than a day. The cached markup already on the page stays visible until (and unless) that request succeeds, so nothing is ever blank while it refreshes, and the page cache itself is never touched or purged.

If you prefer to disable this and rely only on the page cache’s own expiry, add to wp-config.php.

define( 'TIME_MACHINE_DISABLE_REFRESH', true );

How do I turn the front end auto-refresh off?

Add this to wp-config.php:

define( 'TIME_MACHINE_DISABLE_REFRESH', true );

No data-time-machine-* attributes are printed after that, the refresh script is never enqueued, and no REST request is ever made. Lists render once, on the server. On a page held in a full page cache for longer than a day, the list can then be a day or more behind.

The browser console shows a 401 on /wp-json/time-machine/v1/list. What is wrong?

A security plugin or snippet on your site closes the whole REST API to signed out visitors, through the rest_authentication_errors filter. That filter runs before any route can state that it is public, so Time Machine cannot exempt its own route from it, however read only that route is.

Nothing is broken for your visitors. The list is rendered on the server and stays on screen; only the refresh described above is skipped, and the failed request is logged in the console. Time Machine checks this once a day and tells you in Tools → Site Health, which spells out the two options below.

Option 1: switch the refresh off.

Add this to wp-config.php:

define( 'TIME_MACHINE_DISABLE_REFRESH', true );

No request is made after that, so the console stays clean. Lists render once, on the server, exactly as they did before this feature existed. On a page held in a full page cache for longer than a day, the list can then be a day or more behind.

Option 2: let this one route through.

It is read only and returns the same published titles, excerpts and links the page already shows to the same visitor, so letting it through gives nothing away. Add this to a must-use plugin or to your theme’s functions.php:

add_filter(
	'rest_authentication_errors',
	function ( $result ) {

		if ( ! is_wp_error( $result ) ) {
			return $result;
		}

		$route = isset( $GLOBALS['wp']->query_vars['rest_route'] )
			? ltrim( $GLOBALS['wp']->query_vars['rest_route'], '/' )
			: '';

		if ( 0 === strpos( $route, 'time-machine/v1/' ) ) {
			return null;
		}

		return $result;
	},
	99
);

It runs after the restriction and before the core cookie check, and clears the error for the time-machine/v1 namespace only. Every other route keeps the restriction exactly as it is.

Screenshots

Time Machine 26.9.0 - widget
Time Machine 26.9.0 with enabled displaying number of comments

Credits

Note about Google News

User Obragblog noticed an issue with older versions of the Time Machine and reported on community support forum.

Just a note of caution for folks working to rank in Google news… this plugin does exactly what the author says it will, I thought it was a great feature but shortly after implementing it Google News stopped picking up any posts.

Investigating this through Google webmaster tools showed me that links in the Time Machine sidebar widget were causing Google to reindex old posts and killed my ranking as articles had “Date too old“. A few days after I disabled the plugin google news is back, but it really killed my traffic for about a week.

As a solution, we have implemented rel="nofollow" to article links.

Need help?

If something isn’t working, please open a support ticket with details about your issue. We’re committed to helping you get it up and running.

Please check our FAQ section before opening a ticket to see if your question has already been answered.

If Time Machine satisfy your requirements, we’d appreciate a review!