Skip to main content
1 of 4

Custom post type pagination throwing 404 error

I searched around for similar problems but it did not worked for me, im a total beginner with wordpress.

I made a custom query but the pagination throwing me 404 error

my query

$paged = (get_query_var('page')) ? get_query_var('page') : 1;

$default = array(
    'post_type' => 'dlm_download',
    'posts_per_page' => 2,
    'paged' => $paged,
    'meta_key' => '_featured',
    'dlm_download_category' => $term->slug
);

Pagination

$the_query = new WP_Query( $args );
                $big = 999999999; 
                $pagenum = str_replace( $big, '%#%',  get_pagenum_link( $big  ) );

                echo '<div class="pagination">';
                    echo paginate_links( array(
                        'base' => $pagenum,
                        'format' => '?paged=%#%',
                        'current' => max( 1, get_query_var('paged') ),
                        'total' => $the_query->max_num_pages
                    ) );
                echo "</div>";

And when i get http://mysite.com/?dlm_download_category=kategoria-1&paged=2

404 Error, could please someone give me a hint on this?