I think that in most blogs (that is not all) archive pages are redundant content and there’s no need to make these pages available. So I’ve found a method to remove archive pages from WordPress without any plugin but with just a few lines of PHP code.
To remove archive pages in WordPress to prevent users accessing urls like http://www.yourdomain.com/2015/
I’ve found this way that doesn’t affect urls of categories and permalink structure. Remove your archive.php
from your theme, so archives are handled by the index.php
of your theme (rename it __OLD__archive.php
if you’re not sure).
Then open the index.php
file of your theme and put these lines at the beginning. This will force WordPress to send 404 page to any request of archives.
Remove archive pages with php
The code snippet:
if(is_archive()) { // force 404 $wp_query->set_404(); status_header( 404 ); nocache_headers(); include("404.php"); die; }
As you can see you don’t need any plugin to remove archive pages from WordPress, because you can achieve the result with only a few lines of php in your index.php
file. These lines modify the headers and force WordPress archive requests to behave like a 404 (Not found) page.
Archive pages are WordPress pages that show a list of posts (custom or not) organized by date, you can browse them yearly or monthly simply adding /year/month to any wordpress site. You can try this: /2015/ year archive for this site.
You can read more about WordPress archive pages on Codex article “Creating an Archive Index“, but if you need you can remove archive pages, since these pages are not necessary for most blogs, it’s a redundant page that shows artices already lined by category pages and tag pages.
Remove archive pages for SEO purposes
Finally, I also think that removing archive pages can improve your SEO, because in Sarch Engine Optimization you need to put relevant content into the serp and you have not to duplicate contents. Archive pages are very similar to category and tag pages, so – if you push the Google spider to index hundreds or even thousands of pages which only contain links to your posts already linked with better keywords (tags and categories) – you are working for your competitors and not for you.