Title: Loop   exclude posts from main page
Last modified: August 18, 2016

---

# Loop exclude posts from main page

 *  Resolved [Janet Morrow](https://wordpress.org/support/users/mountash/)
 * (@mountash)
 * [19 years, 4 months ago](https://wordpress.org/support/topic/loop-exclude-posts-from-main-page/)
 * I would like to exclude certain categories from the home page. I have tried the
   recommended tag:
 * <?php if (in_category(‘3’) && is_home() ) continue; ?>
 * However, it is not working. Where exactly would I put it? Perhaps that is what
   I’m doing wrong.
 * Here is what I have. Can you please let me know where the above tag would be 
   placed?
 * * * * * *
 * <div id=”rap”>
    <div id=”content”>
 * <?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>
 * <div class=”post”>
 * <h3 class=”storytitle” id=”post-<?php the_ID(); ?>”><?php the_title(); ?></h3
   >
 *  <div class=”storycontent”>
    <?php the_content(); ?> </div>
 *  <!–
    <?php trackback_rdf(); ?> –> </div>
 * <?php endforeach; else: ?>
    <p><?php _e(‘Sorry, no posts matched your criteria.’);?
   ></p> <?php endif; ?> </div>
 * Thank you,
    Janet

The topic ‘Loop exclude posts from main page’ is closed to new replies.

## Tags

 * [excluding](https://wordpress.org/support/topic-tag/excluding/)
 * [loop](https://wordpress.org/support/topic-tag/loop/)
 * [posts](https://wordpress.org/support/topic-tag/posts/)

 * In: [Everything else WordPress](https://wordpress.org/support/forum/miscellaneous/)
 * 0 replies
 * 1 participant
 * Last reply from: [Janet Morrow](https://wordpress.org/support/users/mountash/)
 * Last activity: [19 years, 4 months ago](https://wordpress.org/support/topic/loop-exclude-posts-from-main-page/)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
