Title: Pagination not Working while using query_posts
Last modified: August 21, 2016

---

# Pagination not Working while using query_posts

 *  Resolved [Suresh Patel](https://wordpress.org/support/users/suresh_p12/)
 * (@suresh_p12)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/pagination-not-working-while-using-query_posts/)
 * This is my loop.php code what i want here is remove one category to display on
   home page for that i used below code after adding query_posts code my pagination
   stop working this is the URL of my website [Pixel2Pixel Design](http://pixel2pixeldesign.com).`
   <?php
    if ( is_home() ) { query_posts( ‘cat=-234’ ); } ?>`
 * Thanks in Advance.
    Suresh
 *     ```
       <blockquote><ul class="entry-list group">
   
       <!-- Remove Community News Category from Homepage Start -->
       <?php
       if ( is_home() ) {
           query_posts( 'cat=-234' );
       }
       ?>
       <!-- Remove Community News Category from Homepage End -->
   
       	<?php $i = 1; echo '<li class="entry-row">'; while ( have_posts() ): the_post(); ?>
   
       	<article id="entry-<?php the_ID(); ?>" <?php post_class('entry group'); ?>>
       		<div class="entry-inner">
       			<div class="entry-thumbnail">
       				<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
       					<?php if ( has_post_thumbnail() ): ?>
       						<?php the_post_thumbnail('size-thumbnail-medium'); ?>
       					<?php else: ?>
       						<img src="<?php echo get_template_directory_uri(); ?>/img/placeholder.png" alt="<?php the_title(); ?>" />
       					<?php endif; ?>
       					<?php if ( has_post_format('video') ) echo'<span class="thumb-icon"><i class="icon-play"></i></span>'; ?>
       					<?php if ( has_post_format('audio') ) echo'<span class="thumb-icon"><i class="icon-volume-up"></i></span>'; ?>
       				</a>
       				<?php if ( !wpb_option('post-hide-comments') ): ?><a class="entry-comments" href="<?php comments_link(); ?>"><i class="icon-comments-alt"></i><?php comments_number( '0', '1', '%' ); ?></a><?php endif; ?>
       			</div><!--/.entry-thumbnail-->
   
       			<ul class="entry-meta">
       				<?php if ( !wpb_option('post-hide-categories') ): ?><li class="category">In <?php the_category(' &middot; '); ?></li><?php endif; ?>
       				<?php if ( !wpb_option('post-hide-date') ): ?><li class="date"> &mdash; <?php the_time('j M, Y'); ?> <?php if ( !wpb_option('post-hide-detailed-date') ): ?><?php _e('at','typegrid'); ?> <?php the_time('g:i a'); ?><?php endif; ?></li><?php endif; ?>
       			</ul><!--/.entry-meta-->
   
       			<div class="clear"></div>
   
       			<h2 class="entry-title">
       				<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a>
       			</h2><!--/.entry-title-->
   
       			<div class="text">
       				<div class="excerpt">
       					<?php the_excerpt(); ?>
       					<?php if ( wpb_option('excerpt-more-link-enable') ): ?>
       						<div class="more-link-wrap">
       							<a class="more-link" href="<?php the_permalink(); ?>">
       								<i class="icon-share-alt"></i><span><?php echo wpb_option('read-more', __('(more...)','typegrid')); ?></span>
       							</a>
       						</div>
       					<?php endif; ?>
       				</div><!--/.excerpt-->
       			</div><!--/.text-->
   
       		</div><!--/.entry-inner-->
       	</article><!--/.entry-->	
   
       	<?php if($i % 2 == 0) { echo '</li><li class="entry-row">'; }	$i++; endwhile;	echo '</li>'; ?>
   
       </ul><!--/.entry-list-->
   
       <?php get_template_part('partials/pagination'); ?></blockquote>
       ```
   

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

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/pagination-not-working-while-using-query_posts/#post-3859303)
 * > remove one category to display on home page
 * consider to use `'pre_get_posts'`
 * [http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts](http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts)
   
   [http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts#Exclude_categories_on_your_main_page](http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts#Exclude_categories_on_your_main_page)
 * alternatively, try to change this:
 *     ```
       query_posts( 'cat=-234' );
       ```
   
 * to:
 *     ```
       global $query_string; query_posts( $query_string . '&cat=-234' );
       ```
   
 * [http://codex.wordpress.org/Function_Reference/query_posts#Preserving_Existing_Query_Parameters](http://codex.wordpress.org/Function_Reference/query_posts#Preserving_Existing_Query_Parameters)
 *  Thread Starter [Suresh Patel](https://wordpress.org/support/users/suresh_p12/)
 * (@suresh_p12)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/pagination-not-working-while-using-query_posts/#post-3859305)
 * Thanks alchymyth
    The tip you given is worked for me now it is working perfectly.
 * Thanks again for the help.
 * Regards,
    Suresh

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

The topic ‘Pagination not Working while using query_posts’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [Suresh Patel](https://wordpress.org/support/users/suresh_p12/)
 * Last activity: [12 years, 10 months ago](https://wordpress.org/support/topic/pagination-not-working-while-using-query_posts/#post-3859305)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
