WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having an odd issue, although I can understand why it works like this I do need to find a way around it.

I have used the the request filter to modify the query for the home/index page to select for a post type other than 'post'

The result of this is that is_home() is returning false in the index.php template. If I disable the filter then is_home() goes back to returning true.

Anyway to force the is_home() to return true? or another way to approach this?

Thanks, Stewart.

share|improve this question
Is this related? When to use is_home() vs is_front_page()? – brasofilo Jun 13 '12 at 10:43
@brasofilo unfortunately no. I haven't changed the page that is acting as the home or the front page within the Admin Panel, I have just modified the query it uses. Therefore in this case both is_home() and is_front_page() should return true but neither do. – Stewarty Jun 13 '12 at 10:53
I see... so, it'd be better if you published your code... – brasofilo Jun 13 '12 at 10:56
Please provide us with at least the function and the filter you are using. – BandonRandon Sep 20 '12 at 6:45

From look at the code the following logic happens in your case:

  • query is for one post type that has archive
  • is_post_type_archive gets set to true
  • is_archive gets set to true
  • is_home gets set to false since it is seen as archive

I am not sure about all implications without extensive testing, but probably approaches are either:

  1. artificially set is_home to true under those circumstances
  2. ignore failing is_home() and use different conditional
share|improve this answer

Your Answer


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.