Title: Dont show &quot;uncategorized&quot; posts
Last modified: August 21, 2016

---

# Dont show "uncategorized" posts

 *  [j4ze](https://wordpress.org/support/users/j4ze/)
 * (@j4ze)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/dont-show-uncategorized-posts/)
 * I’ve made a template where i want to show all posts from a certain category. 
   And it actually works fine, however for some reason it also shows the posts from
   the “uncategorized” category, which i find very odd, since i specifically pointed
   out the category name in my code.
 * Heres my code:
 *     ```
       <?php
   
       /* Template Name: Konkurrencer */
   
       get_header(); ?>
   
          <div id="container">
   
              <div id="content" role="main">
   
                  <?php get_template_part( 'loop', 'page' ); ?>
                  <?php $temp_query = $wp_query; ?>
                  <?php query_posts('Konkurrencer=&showposts=5'); ?>  
   
                  <?php while (have_posts()) : the_post(); ?>  
   
                    <div id="post-<?php the_ID(); ?>">
                       <h2><a href="<?php the_permalink() ?>" rel="bookmark"
        title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
   
               <div class="entry-summary">
                  <?php the_excerpt(); ?>
              </div>
       	<a href="<?php the_permalink(); ?>" class="read-more">Deltag i konkurrencen<span class="more-arrow">&raquo;</span></a>
            </div>  
   
       <?php endwhile; ?>  
   
         </div><!-- #content -->
   
       </div><!-- #container -->
   
       <?php /* get_sidebar(); */ ?>
       <?php get_footer(); ?>
       ```
   
 * Hope someone can guide me

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [graphical_force](https://wordpress.org/support/users/graphical_force/)
 * (@graphical_force)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/dont-show-uncategorized-posts/#post-4244212)
 * The issue is here:
 * <?php query_posts(‘Konkurrencer=&showposts=5’); ?>
 * I’m guessing that Konkurrencer is the category? If so, then it would look like
   this:
 * <?php query_posts(‘cat=Konkurrencer&showposts=5’); ?>
 *  Thread Starter [j4ze](https://wordpress.org/support/users/j4ze/)
 * (@j4ze)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/dont-show-uncategorized-posts/#post-4244221)
 * Thank you for the quick response, i tried changing my code according to your 
   suggestion, but unfortunately the posts from “uncategorized” still shows up –
   actually nothing changed at all when changing the code…
 * And you’re right – the single category im trying to get posts from is called “
   konkurrencer”
 * any other ideas/suggestions?
 *  [graphical_force](https://wordpress.org/support/users/graphical_force/)
 * (@graphical_force)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/dont-show-uncategorized-posts/#post-4244231)
 * Can you now post your code? Also, you should be using wp_query instead of query_posts
   and it looks like you tried that at some point since you have this line: <?php
   $temp_query = $wp_query; ?>
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/dont-show-uncategorized-posts/#post-4244280)
 * > you should be using wp_query instead of query_posts
 * yes – [http://wordpress.stackexchange.com/questions/1753/when-should-you-use-wp-query-vs-query-posts-vs-get-posts?rq=1](http://wordpress.stackexchange.com/questions/1753/when-should-you-use-wp-query-vs-query-posts-vs-get-posts?rq=1)
 * also review
    [http://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters](http://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters)
 * i.e. possibly try to use these parameters:
 * `'category_name=konkurrencer&posts_per_page=5'`

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Dont show "uncategorized" posts’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 3 participants
 * Last reply from: [Michael](https://wordpress.org/support/users/alchymyth/)
 * Last activity: [12 years, 5 months ago](https://wordpress.org/support/topic/dont-show-uncategorized-posts/#post-4244280)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
