Title: query_posts not working
Last modified: August 19, 2016

---

# query_posts not working

 *  [webmister](https://wordpress.org/support/users/webmister/)
 * (@webmister)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/query_posts-not-working-1/)
 * It seems like “query_posts” doesn’t work.
    i set new category name and number
   of posts to display, but it shows the same category and number of posts in the
   wp admin options :S
 *     ```
       <?php $temp_query = $wp_query; ?>
               <?php query_posts('category_name=' . get_option('gallery-category') . '&showposts=' . get_option('gallery-items')); ?>
               <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
               <div class="imageElement">
                   <h2><?php the_title() ?></h2>
                   <p><?php the_content_rss('', TRUE, '', 30); ?></p>
                   <a href="<?php the_permalink() ?>" title="Read More" class="open"></a>
                   <img src="<?php $key="articleimg"; echo get_post_meta($post->ID, $key, true); ?>" class="full" />
                   <img src="<?php $key="articleimg"; echo get_post_meta($post->ID, $key, true); ?>" class="thumbnail" />
               </div>
               <?php endwhile; else: ?>
               <?php endif; ?>
               <?php $wp_query = $temp_query; ?>
       ```
   

The topic ‘query_posts not working’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [webmister](https://wordpress.org/support/users/webmister/)
 * Last activity: [17 years, 5 months ago](https://wordpress.org/support/topic/query_posts-not-working-1/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
