Why isn’t is_home() working correctly?

I put a if(is_home()) bit in my theme’s functions.php and it doesn’t seem to work. The function containing this bit is called on init so is_home should work already.

2 Answers
2

is_home() won’t work until wp_query is run. The earliest hook you can use where is_home will work is 'parse_query', but 'template_redirect' would be better.

Leave a Comment