Skip to content

Early-bird lifetime licence: $199 once, for the first 200 buyers only. See the offer

Turn off date archives

Date archives (/2024/05/) redirect to the home page. Most sites never link to them, but search engines still find and crawl them.

  • Type PHP
  • Runs Everywhere (runs as WordPress loads)
  • Category SEO
  • Tested with WordPress 7.1
PHP
<?php

add_action(
	'template_redirect',
	static function () {
		if ( is_date() ) {
			wp_safe_redirect( home_url( '/' ), 301 );
			exit;
		}
	}
);

Good to know

Don’t use it if your permalinks contain the date (/%year%/%monthnum%/%postname%/): posts still work, but the date parts of their addresses go to the home page.

In these packs

  • SEO basics: Meta descriptions, social sharing tags, article structured data and cleaner indexing, for sites without an SEO plugin.
  • Turn off more: More features you may not need: sitemaps, trackbacks, automatic updates, pattern suggestions.

Move your snippets over this afternoon.

Importing changes nothing until you switch over, and your old shortcodes keep working.