Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Disable Date Based Archives
// This will redirect all date based archive to a page that does not exist,
// effectively disabling them, with a 404 error code
add_action( 'template_redirect', 'pu01_date_archive_not_found' );
function pu01_date_archive_not_found() {
if ( is_date() ) {
wp_redirect( get_home_url() . '/date-archive-not-found', 301 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.