Title: Using &#8216;query_posts&#8217; parameters in author.php
Last modified: August 19, 2016

---

# Using ‘query_posts’ parameters in author.php

 *  Resolved [Ruskin](https://wordpress.org/support/users/hedley/)
 * (@hedley)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/using-query_posts-parameters-in-authorphp/)
 * My author.php correctly displays information from the user record and a list 
   of titles of that users posts. This is good. Now I want to limit the post titles
   that are displayed by excluding two categories, and I also want to force it to
   display _all_ post titles, instead of the globally set ten posts.
 * To my author.php I added (right at the start of the loop): `<?php query_posts('
   showposts=9999&cat=-30,-32'); ?>`. It works, in the sense that it excludes the
   two categories and removes the 10 post limit, BUT, it displays posts from ALL
   users, not just the one specified in the curauth variable (yet still displays
   the curauth data for the correct user).
 * I assume that use of ‘query_posts’ is overriding the post selection somehow, 
   but I’m at a loss where and how. Can anyone spot the flaw in my usage? Here’s
   my entire author.php.
 * Thanks!
 *     ```
       <?php get_header(); ?>
          <div id="content" class="narrowcolumn">
             <!-- This sets the $curauth variable -->
       <?php
       if(isset($_GET['author_name'])) :
       $curauth = get_userdatabylogin($author_name);
       else :
       $curauth = get_userdata(intval($author));
       endif;
       ?>
   
       <h2>About: <?php echo $curauth->nickname; ?></h2>
       <dl>
       <dt>Website</dt>
       <dd><a href="<?php echo $curauth->user_url; ?>"><?php echo $curauth->user_url; ?></a></dd>
       <dt>Profile</dt>
       <dd><?php echo $curauth->user_description; ?></dd>
       </dl>
   
       <h2>Posts by <?php echo $curauth->nickname; ?>:</h2>
   
       <ul>
       <!-- The Loop -->
       <?php query_posts('showposts=9999&cat=-30,-32'); ?><?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
         <li>
       <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>">
       <?php the_title(); ?></a>,
       <?php the_time('d M Y'); ?> in <?php the_category('&');?>
         </li>
   
         <?php endwhile; else: ?>
            <p><?php _e('No posts by this author.'); ?></p>
   
       	<?php endif; ?>
       <!-- End Loop -->
       </ul>
       </div>
       <?php get_sidebar(); ?>
       <?php get_footer(); ?>
       ```
   

Viewing 1 replies (of 1 total)

 *  [harjeet singh](https://wordpress.org/support/users/harjeet-singh/)
 * (@harjeet-singh)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/using-query_posts-parameters-in-authorphp/#post-952573)
 * Try replacing
 * > <?php query_posts(‘showposts=9999&cat=-30,-32’); ?>
 * with
 * > <?php query_posts($query_string.’&showposts=9999&cat=-30,-32′); ?>
 * Just added “$query_string.” and “&” before showposts.

Viewing 1 replies (of 1 total)

The topic ‘Using ‘query_posts’ parameters in author.php’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [harjeet singh](https://wordpress.org/support/users/harjeet-singh/)
 * Last activity: [16 years, 8 months ago](https://wordpress.org/support/topic/using-query_posts-parameters-in-authorphp/#post-952573)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
