I have a personal blog where I write general posts. I decided I'd like to seldom post about some other topic (let's say it's cats), that interests a very different audience then my current one. So I want to sometimes write about cats, but I want those cats posts not to appear in the main posts page on my home page. I'd like to have a separate page where the cats posts all appear and where I control the page's URL (e.g. "site.com/cats").

One idea I had is to:

  1. Tag all the cats posts with a certain tag (e.g. 'cats')
  2. On the main posts page, filter out posts with the 'cats' tag, as well is in the "recent posts" appearing on my homepage
  3. Somehow refer the page site.com/cats to the tag page of 'cats', only showing posts tagged with 'cats'

My problem is that I couldn't find a simple way to do (2) and (3). Is there an out-of-the box way to achieve that? My site is here.

2 Answers 2


The best way would be to just add a cats category and filter those out from the home page using the pre_get_posts filter.

function kill_kittens( $query ) {
    if ( $query->is_home ) {
        $query->set( 'cat', '-23' ); //assumes the cats category id is 23
add_action( 'pre_get_posts', 'kill_kittens' );

For your cats page you could create a custom category archive template or just create a custom page and a simple template the queries all the posts in cats category.

 * Template Name: kitties

get_header(); ?>

<div id="kittens">
<?php $kitty_query = new WP_Query( 'cat' => 23 ); //assuming again cat category id is 23

while ( $kitty_query->have_posts() ) : $kitty_query->the_post();

//do stuff


wp_reset_postdata(); ?>


<?php get_sidebar();

To exclude a certain tag from the content you can use this before the loop in you theme files:

if (is_home()) {
  global $wp_query;
  $wp_query->set("tag__not_in", array(1));

The above uses the tag__not_inquery args (view the codex page for options) You will need the tag id (available in the URL when viewing the specified tag in WP-Admin area: Posts/Tags/Cats.

To use something other than is_home look here for more options: http://codex.wordpress.org/Conditional_Tags

To display the posts with the cats tag only you could use:

  global $wp_query;
  $args = array(
  'tag' => 'cats',
  'order'    => 'ASC'
  query_posts( $args );
    // The Loop
    while ( have_posts() ) : the_post(); 
    echo '<li>';    the_title(); 
    echo '</li>'; 
wp_reset_query(); // Reset Query ?>

The codex page for query_posts has good info for options or a detailed explanation of what's happening in the code above: http://codex.wordpress.org/Function_Reference/query_posts

For your question regarding the redirect:

site.com/cats to the tag page of 'cats', only showing posts tagged with 'cats'

There are a few ways to handle this. Maybe create a page template or conditional statement to handle the option. You could create page template, make a new page called cats and assign the new page template to the cats page. Depending on your permalink structure it could use the URL yoursite.com/cats. Just place the query shown above for displaying the post titles of the posts tagged with cats. You'll need to adjust the actual loop code to match your desired outcome.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.