Support » Fixing WordPress » Automatically Don't Post on Home Page

  • Resolved jackmcnally



    I have categories that people will be posting in (I restricted posting to these categories for certain users), and I don’t want those posts to show up on the home page. There will be a large amount of posters, so asking them to check a box every time they post may be hard. Is there a way for posts to automatically not show up on the homepage, but show up on the homepage if I tick a box, or post in a certain category?

    Sorry if you don’t understand, I don’t know how else to say it, let me know if you need more info!

    Thanks heaps,

Viewing 4 replies - 1 through 4 (of 4 total)
  • To only include/exclude certain categories on the home page you can use query_posts().

    Something like this before the loop in your theme’s index.php file would work (replacing the numbers with the ID’s of the categories you want of course):

    if ( is_home() ) {
        global $wp_query;
        $args = array_merge( $wp_query->query, array(
            'category__in' => array( 27, 42 )
        ) );
        query_posts( $args );

    And as always, if you need to edit your theme and aren’t doing this already, it’s best to use a child theme.


    I did so on my index.php , but to no avail. It seems to be what I want to do, but is not working. I’m unsure as to if index.php is the right place to put it, all the index.php file says is <?php // Silence is golden? ?> . I’m using the mystique theme, if that helps.


    Never seen a theme that didn’t use index.php at all. Awesome sauce.

    Try home.php instead. It looks like that’s where the loop that runs on the home page lives.

    No matter! I used a plugin called Exclude Categories from Front Page. It works perfectly! Thanks for all your help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Automatically Don't Post on Home Page’ is closed to new replies.