Title: query_posts() function acts weird&#8230; need help!
Last modified: August 19, 2016

---

# query_posts() function acts weird… need help!

 *  [loomybear](https://wordpress.org/support/users/loomybear/)
 * (@loomybear)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/query_posts-function-acts-weird-need-help/)
 * Dear WP gurus!
 * Please help me to clarify:
 * when I’m trying to show posts from a single or multiple categories using this
   in the page code:
 * <?php query_posts(cat=’3′);> or <?php query_posts(cat=’3,4,5′);>
 * as a result I have a completely blank page???
 * But when I excluding the category like this:
 * <?php query_posts(cat=’-4′);>
 * as a result I have all posts except the posts from category with ID 4, as I think
   it works perfect…
    but why then WP generates blank page when I tell him to show
   category with a specified ID??
 * Here is a complete loop code it’s quite simple:
 * <?php query_posts(‘cat=3’) ?>
    <?php if (have_posts()) : ?> <?php while (have_posts()):
   the_post(); ?>
 *  <!–LOOP CONTENT–>
 *  <?php endwhile; ?>
    <?php endif; ?>
 * Thnx in advance for help!

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

 *  Thread Starter [loomybear](https://wordpress.org/support/users/loomybear/)
 * (@loomybear)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/query_posts-function-acts-weird-need-help/#post-1035163)
 * oh… I’m sorry… almost forgotten
    when I use <?php query_posts(‘category_name=
   usefull_info’);> wp generates blank page too!
 * but
    <?php query_posts(‘p=47’); ?> works fine.
 * I donno what to do I tried evrth.
 *  [jarodtaylor](https://wordpress.org/support/users/jarodtaylor/)
 * (@jarodtaylor)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/query_posts-function-acts-weird-need-help/#post-1035561)
 * I’m having the same exact problem. Does anyone know what’s causing it?

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

The topic ‘query_posts() function acts weird… need help!’ is closed to new replies.

## Tags

 * [blank-page](https://wordpress.org/support/topic-tag/blank-page/)
 * [query_posts](https://wordpress.org/support/topic-tag/query_posts/)
 * [trouble](https://wordpress.org/support/topic-tag/trouble/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [jarodtaylor](https://wordpress.org/support/users/jarodtaylor/)
 * Last activity: [16 years, 11 months ago](https://wordpress.org/support/topic/query_posts-function-acts-weird-need-help/#post-1035561)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
