Title: query-post loop
Last modified: August 19, 2016

---

# query-post loop

 *  [owsian](https://wordpress.org/support/users/owsian/)
 * (@owsian)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/query-post-loop/)
 * Hello there!
 * I’ve got some problem with my query.
 *     ```
       <?php $my_query = new WP_Query('posts_per_page='.$wm_post_number.'');
       	while ($my_query->have_posts()) : $my_query->the_post();
       	$do_not_duplicate = $post->ID; ?>
       ```
   
 * I’ve been building kind of administration panel to my theme, but this is not 
   working good. I mean, this line” `'.$wm_post_number.'`
    It’s variable which you
   can change by filling with your own value. But problem is, that when you change
   it, link like a “Previous posts” doesn’t work. By clicking there, on [http://domain.com/page/2](http://domain.com/page/2)
   you can see the same posts..
 * Have you got any idea to solve this problem?
    Best regards!

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

 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/query-post-loop/#post-1737168)
 * In addition to presthe you need to use a proper pagination construct such as:
 *     ```
       <?php
       $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
       query_posts('cat=3&posts_per_page='.get_option('posts_per_page').'&paged=' . $paged);
       ?>
       ```
   
 * One example:
    [http://wordpress.org/support/topic/taxonomy-pagination-1?replies=21#post-1750529](http://wordpress.org/support/topic/taxonomy-pagination-1?replies=21#post-1750529)
 *  Thread Starter [owsian](https://wordpress.org/support/users/owsian/)
 * (@owsian)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/query-post-loop/#post-1737235)
 * When I’ve added this code under my query, there were still the same action..
 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/query-post-loop/#post-1737309)
 * You’ll want to confirm with that link I presented that your code is similar.

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

The topic ‘query-post loop’ is closed to new replies.

## Tags

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

 * 3 replies
 * 2 participants
 * Last reply from: [MichaelH](https://wordpress.org/support/users/michaelh/)
 * Last activity: [15 years, 7 months ago](https://wordpress.org/support/topic/query-post-loop/#post-1737309)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
