Created
July 29, 2013 04:07
-
-
Save jeffsebring/6102096 to your computer and use it in GitHub Desktop.
Disable Date Based Archives
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 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 ); | |
exit; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment