I have a problem when using WordPress 3.4. My “Products” custom post type pagination doesn’t work. Here is the code I use
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$loop = new WP_Query( array(
'post_type' => 'products',
'posts_per_page' => PER_PAGE_DEFAULT,
'paged'=>$paged
) );
That code works well in previous WP version (WordPress 3.3.2) but not in current version i.e. 3.4. What am I doing wrong?
Use
get_query_var('page')
instead ofget_query_var('paged')
. Related ticket: #21028