title: Need help to exclude posts from wordpress blog home page
body: <p>I am trying to exclude posts from my index page. I have the below code in my functions.php to accomplish that:</p>
  
  <pre><code>function my_cat_exclude($query) {
   if ($query-&gt;is_home) {
    //$query-&gt;set('cat','-1,-3,-4,-5,-6,-7,-8,-9,-10');
    $query-&gt;set('cat','11');
   }
  return $query;
  }
  add_filter('pre_get_posts','my_cat_exclude');
  </code></pre>
  
  <p>I have 12 categories in my blog. I would like to show posts from only one category (category id 11). I don't want to show the rest on homepage.</p>
  
  <p>If I use <code>$query-&gt;set('cat','-1,-3,-4,-5,-6,-7,-8,-9,-10');</code> it doesn't show posts which shares the same category with category id 11. For example, if a post is assigned to two categories category id 5 and category 11, then, it doesn't shows that post in my home page. I would like to show all posts belong to category id 11 on my home page.</p>
  
  <p>If I use <code>$query-&gt;set('cat','11');</code> It shows only category with category id 11. however, it removes the other category posts, custom menus from sidebar widget. Also, removes the menu items from top menu.</p>
  
  <p>Please help.</p>
  
  <p>Thanks</p>