WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created a query which work correctly and displays the pagination correctly. However when clicking the links /products/category/application-range/page/2 the page will load and go back to /products/category/application-range/ rather than page 2, is there any reason why?

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
  'connected_type'      => 'product_to_category',
  'connected_items'     => $post,
  'posts_per_page'  => 10,
  'paged'           => $paged,
  'post_parent'     => 0,
  'orderby'         => 'menu_order',
  'order'           => 'ASC'

$products = query_posts($args);
share|improve this question
Probably this. – toscho May 22 '13 at 15:46

Perhaps you can take a look at this question and the answers and check if you really want to use query_posts() as it is not recommended while dealing with posts pagination. Why not use pre_get_posts action instead? Or you can try something like this:


    $custom_query = new WP_Query(array(
        'post_status' => 'publish',
        'post_type' => 'products',
        'connected_type' => 'product_to_category',
        'connected_items' => $post,
        'order' => 'ASC',
        'order_by' => 'menu-order',
        'posts_per_page' => '10',
        'paged' => (get_query_var('paged')) ? get_query_var('paged') : 1

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.