Support » Fixing WordPress » how to prevent query_posts() to change status from home to category/archive?

  • Hi all,

    In my home.php I am calling query_posts(“cat=8”) to display posts only from one category on the home page. This works fine but the problem is that the status of the posts is not “home” but “category” and “archive”. This is a problem for content.php which is checking the status using is_home(), and this fails … although they are on the home page.

    Is there a way to prevent this and maintain “home” status for the posts?

    Currently I am hacking it by having the following right after query_posts():

    global $wp_query;
    $wp_query->is_home = true;

    Which forces the is_home flag. Is there a more elegant solution?

    It’s hard to call this a bug, but I think it is at least unexpected behaviour.

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘how to prevent query_posts() to change status from home to category/archive?’ is closed to new replies.