How to Disable Date Archives pages in WordPress

In WordPress, date archives pages (or custom archives) are a way of displaying older posts in a separate page on your site, and can be a great way to show readers what’s been going on in your blogosphere. However, they can sometimes be an irritation and, in some cases, downright annoying. These archive pages may contains thin content, which is harmful for SEO perspective.

Luckily, they can be disabled in WordPress, here’s how.

Frist login to your Cpanel / FTP, navigate to active theme directory. Search for function.php file. Open the function.php file via code editor. 

Copy the following code and paste it inside the function.php file. 

				
					// Remove date archives
add_action('template_redirect', 'jltwp_adminify_remove_archives_date');
function jltwp_adminify_remove_archives_date()
{
    if (is_date()){
        $target = get_option('siteurl');
        $status = '301';
        wp_redirect($target, 301);
        die();
    }
}

				
			

Have y ou installed “WP Adminify” already? Then you can do it without coding stuff. Just navigate to WP Adminify > Tweaks > Post / Archive option. You will see “Disable Date Archives” option there. Just enable it and save the settings. 

Disable Date Archives in wordpress
Was this article helpful?

© 2021-2024 - Adminify | All rights reserved

WP Adminfy accepted payment methods