WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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 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


$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

$args = $default;

foreach ($downloads as $download) :  setup_postdata($download); 
// loop here


$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?

share|improve this question
This question has been asked a lot lot lot of times. wordpress.stackexchange.com/questions/120407/… or wordpress.stackexchange.com/questions/109213/… – cybmeta Apr 23 '14 at 8:55
As i highlighted, i searched, and it did not fix my problem, otherwise i would not asked – Levente Nagy Apr 23 '14 at 9:09
You are defining the arguments for the query in the $default variable but then pass an unknown $args variable to the new WP_Query, appart of that kind of PHP errors, your question is almost equal to a lot of questions asked before. – cybmeta Apr 23 '14 at 9:29
edited my question so you can see im passing correct data – Levente Nagy Apr 23 '14 at 9:43
Sorry @LeventeNagy but you are still using undefined variables, like $downloads, and your question is still almost equal to a lot of questions here in WPSE, like the questions linked in a previous comment. – cybmeta Apr 23 '14 at 11:24

Your Answer


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

Browse other questions tagged or ask your own question.