WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to build multiple loops for different parts of my page but I can't isolate a category.

I just get to see every post the category is ignored.

Below my code, any suggestions would be greatly appreciated as I'm somewhat at a loss what I'm doing wrong. Thanks!

<div id="postblokcontainer">
    $first_query = new WP_Query('cat=Postblok');
    while($first_query->have_posts()) : $first_query->the_post(); ?>
    <article id="postblok">
        <h1><?php the_title(); ?></h1>

        <h3> </h3>
        <?php the_content(); ?>
        <ul class="socmed">
            <li><img src="<?php bloginfo("template_url"); ?>/images/mockup.jpg"></li>

    <?php endwhile; ?>
    <?php wp_reset_postdata(); ?>

share|improve this question
up vote 1 down vote accepted

The cat parameter takes an ID and not the category name or slug. If you want to use the slug you need category_name but it must be the slug.

$first_query = new WP_Query('category_name=postblok');

Other category parameters are:

    cat (int) - use category id.
    category_name (string) - use category slug (NOT name).
    category__and (array) - use category id.
    category__in (array) - use category id.
    category__not_in (array) - use category id. 
share|improve this answer
Perfect. Thanks a lot! :) – Timsalabim Jul 8 '13 at 20:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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