Title: Help with query_posts
Last modified: August 18, 2016

---

# Help with query_posts

 *  [billsaysthis](https://wordpress.org/support/users/billsaysthis/)
 * (@billsaysthis)
 * [19 years, 9 months ago](https://wordpress.org/support/topic/help-with-query_posts/)
 * For a plugin I’m trying to get all the posts and process them. For testing, I’m
   using a small number but even so I only seem to get one. Any help in correcting
   this is much appreciated.
 * Here’s the code (not sure where the white space went):
    ` query_posts('showposts
   =25&posts_per_page=-1'); if (have_posts()) { while (have_posts()) { the_post();
   $ttl = htmlspecialchars(the_title('', '', false)); $url = htmlspecialchars(get_permalink());
   $aCat = get_the_category(); $cats = ""; foreach($aCat as $cat) { if($cat->category_parent){
   $cats .= $cat->category_parent."/"; } $cats .= $cat->cat_name.","; } $cats = 
   htmlspecialchars($cats); $prms = "url=" . $url . "&title=" . $ttl . "&tags=" .
   $cats;
 *  (do something with the prms)
    $i++; } } Thanks, Bill

The topic ‘Help with query_posts’ 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: [billsaysthis](https://wordpress.org/support/users/billsaysthis/)
 * Last activity: [19 years, 9 months ago](https://wordpress.org/support/topic/help-with-query_posts/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
