[wp-testers] Conditional tags not working

Nathan Rice ncrice at gmail.com
Sun Jan 17 05:21:26 UTC 2010


As this post points out:
http://weblogtoolscollection.com/archives/2010/01/16/fix-for-is_home-is_archive-not-working/

conditional tags like is_home(), is_page, is_archive(), etc., are all
seemingly not working. I've noticed this as well (running 2.9.1).

I believe that it might work in some circumstances (like in the loop?), but
I am currently running into the problem when trying to conditionally do
something in the theme's functions.php file.

The article linked to above suggests using wp_reset_query() before using a
conditional, but that does NOT work in functions.php, though it may work in
a file like footer.php.

Does anyone have any clue as to why this is happening? I dumped the
$wp_query object and all the conditionals in them have null values, which is
of course why conditional tags aren't working ... which begs the question,
why isn't the $wp_query object returning accurate values for the
conditionals?

I'm stumped. Any takers?

------------------
Nathan Rice
WordPress and Web Development
www.nathanrice.net | twitter.com/nathanrice


More information about the wp-testers mailing list