What to do if is_home() and is_archive() aren’t working in WordPress ( How to fix )


It sometimes happens that the is_home() and is_archive() functions stop working in some WordPress installs, so you can’t make use of them anymore. It has happened to me a few times and I’ve had a hard time replacing them with more complicated code. Fortunately, there’s one simple solution for this problem.

If calling is_home() or is_archive() doesn’t return the correct boolean value, then try using the wp_reset_query() WordPress function before them.

Here’s an example:



if(is_home()) echo’Welcome home!’;


Please note this might also help if other functions stop working, like: is_category, in_category, is_tag, has_tag etc.

Let me know if this worked for you, because it works like charm for me on all my blogs.

Tags: wordpress, working, is_archive, is_home, like, stop, wp_reset_query, functions, echowelcome, home, boolean, please, ifis_home, example, note, value, function, heres, using, in_category, because, worked, works, charm, blogs, know, has_tag, help, is_category, correct