WordPress is_archive() is not working

If you use or are developing a theme that relys on the native WordPress function is_archive() – and it’s not working, here’s an easy fix:

Use is_page_template instead of is_archive

Instead of using:

if ( is_archive() )

Try using:

if ( is_page_template( 'archives.php' ) )

(Assuming you are using archives.php for calling your Archives template. Sometimes it can be called from a plugin such as Elementor on a regular page – i.e. page.php)