title: Wordpress - Custom Taxonomy Pagination
body: <p>I'm using:</p>
  
  <ul>
  <li>Wordpress 3.4</li>
  <li>WP-PageNavi 2.82</li>
  </ul>
  
  <p>I register custom taxonomy (<em>catalog</em>)</p>
  
  <pre><code>&lt;?php
  
  add_action('init', 'pca_register_taxonomy', 0);
  
  function pca_register_taxonomy()
  {
      register_taxonomy('catalog', null,
         array(
              'label' =&gt; __('Catalogs', __),
              'labels' =&gt; array(
                  'name' =&gt; __('Catalogs', __),
                  'singular_name' =&gt; __('Catalog', __),
                  'search_items' =&gt; __('Search Catalogs', __),
                  'popular_items' =&gt; __('Popular Catalogs', __),
                  'all_items' =&gt; __('All Catalogs', __),
                  'parent_item' =&gt; __('Parent Catalog', __),
                  'parent_item_colon' =&gt; __('Parent Catalog', __),
                  'edit_item' =&gt; __('Edit Catalog', __),
                  'update_item' =&gt; __('Update Catalog', __),
                  'add_new_item' =&gt; __('Add New Catalog', __),
                  'new_item_name' =&gt; __('New Catalog Name', __),
                  'separate_items_with_commas' =&gt; __('Separate catalogs with commas', __),
                  'add_or_remove_items' =&gt; __('Add or remove catalogs', __),
                  'choose_from_most_used' =&gt; __('Choose from the most used catalogs', __),
                  'menu_name' =&gt; __('Catalogs', __)
              ),
              'public' =&gt; true,
              'show_in_nav_menus' =&gt; true,
              'show_ui' =&gt; true,
              'show_tagcloud' =&gt; false,
              'hierarchical' =&gt; true,
              'query_var' =&gt; true,
              'rewrite' =&gt; array(
                  'slug' =&gt; 'catalog',
                  'with_front' =&gt; true,
                  'hierarchical' =&gt; true
              ),
              'capabilities' =&gt; array(
                  'manage_terms',
                  'edit_terms',
                  'delete_terms',
                  'assign_terms'
              )
          )
      );
  }
  
  ?&gt;
  </code></pre>
  
  <p>I register custom post type (<em>product</em>)</p>
  
  <pre><code>&lt;?php
  
  add_action('init', 'pca_register_post_type');
  
  function pca_register_post_type()
  {
      register_post_type('product',
          array(
              'label' =&gt; __('Products', __),
              'labels' =&gt; array(
                  'name' =&gt; __('Products', __),
                  'singular_name' =&gt; __('Product', __),
                  'add_new' =&gt; __('Add New', __),
                  'add_new_item' =&gt; __('Add New Product', __),
                  'edit_item' =&gt; __('Edit Product', __),
                  'new_item' =&gt; __('New Product', __),
                  'all_items' =&gt; __('All Products', __),
                  'view_item' =&gt; __('View Product', __),
                  'search_items' =&gt; __('Search Products', __),
                  'not_found' =&gt;  __('No products found', __),
                  'not_found_in_trash' =&gt; __('No products found in Trash', __), 
                  'parent_item_colon' =&gt; '',
                  'menu_name' =&gt; __('Products', __)
              ),
              'description' =&gt; '',
              'public' =&gt; true,
              'exclude_from_search' =&gt; false,
              'publicly_queryable' =&gt; true,
              'show_ui' =&gt; true,
              'show_in_nav_menus' =&gt; true,
              'show_in_menu' =&gt; true,
              'show_in_admin_bar' =&gt; true,
              'menu_position' =&gt; 20,
              'capability_type' =&gt; 'post',
              'meta_cap' =&gt; true,
              'hierarchical' =&gt; false,
              'supports' =&gt; array(
                  'title',
                  'editor',
                  'thumbnail',
                  'page-attributes',
                  'post-formats'
              ),
              'taxonomies' =&gt; array('catalog'),
              'has_archive' =&gt; false,
              'rewrite' =&gt; array(
                  'slug' =&gt; 'products',
                  'with_front' =&gt; true,
                  'feeds' =&gt; false,
                  'pages' =&gt; true
              ),
              'query_var' =&gt; true,
              'can_export' =&gt; true
          )
      );
  }
  
  ?&gt;
  </code></pre>
  
  <p>Then I create a new file for tax -> <strong>taxonomy-catalog.php</strong></p>
  
  <p>In this file, I query all products (<em>custom post type</em>) from specified catalog (<em>tax</em>):</p>
  
  <pre><code>&lt;?php
  
  $paged = get_query_var('paged');
  $paged = ($paged) ? $paged : 1;
  
  $products = new WP_Query(array(
      'catalog' =&gt; $catalog_data-&gt;slug, // $catalog_data is the current taxonomy (woman)
      'post_type' =&gt; 'product',
      'posts_per_page' =&gt; 12,
      'paged' =&gt; $paged
  ));
  
  ?&gt;
  
  &lt;?php while ($products-&gt;have_posts()) : $products-&gt;the_post(); ?&gt;
  // Show title, content ... everything ok
  &lt;?php endwhile; ?&gt;
  
  &lt;?php if (function_exists('wp_pagenavi')) wp_pagenavi(array('query' =&gt; $products)); ?&gt;
  &lt;?php wp_reset_postdata(); ?&gt;
  </code></pre>
  
  <p>Pagination is displayed correctly but when I click on page 2 or over I have a 404 error.</p>
  
  <ul>
  <li>Works -> mywebsite.com/catalog/woman</li>
  <li>Works not -> mywebsite.com/catalog/woman/page/2</li>
  </ul>
  
  <p>I already refreshed permalinks.</p>
  
  <p>Any idea to fix this ? thanks</p>