Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm wondering why my link: http://localhost/?page_id=3433 returns TRUE on is_home() usage:

if(is_home()){
    var_dump(is_home());                            
    die('test');                            
}

It clearly has template-mycustomtemplate.php set under Pages > This Page in Admin Panel. Can anyone shed some light on that?

UPDATE: it returns TRUE in the loop but FALSE outside the loop. So, I can use workaround but nonetheless, it looks like a bug to me if it returns TRUE in the loop that is present in that template file.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I discovered that it isn't actually a bug. In the loop is_home() will refer to the currently looped object and not to the page that you accessed. In fact that's handy!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.