Support » Plugin: WP-PageNavi » [Plugin: WP-PageNavi] wp-pagenavi throws error 404

  • Hi Need Help!, WP-PageNavi throws error 404 once i click to the next page, for example im on Page 1 of 10, then when i click to Page 2 and so on, it directs to page 404.

    heres my code :

    // The Query
    $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
    $args = array('post_type' => 'presse', 'status' => 'publish', 'paged' => $paged, 'orderby' => 'date');
    $the_query = new WP_Query($args);
    // The Loop
    // wp_reset_query();
    if ($the_query->have_posts()):
    	while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
    		<div class="news-list-wrapper">
    			<div class="news-list group">
    				<h2 class="published"><?php the_time('d.m.Y'); ?></h2>
    				<a href="<?php the_permalink() ?>"><?php the_title('<h1>', '</h1>'); ?></a>
    				<?php the_excerpt(); ?>
    <?php endwhile; ?>
    <div class="pagination_btn">
    		wp_pagenavi(array('query' => $the_query));
    <?php else: ?>
    	<div><p>No Content Available</p></div>
    <?php endif; ?>

    heres the link :

    Hope for you response,


Viewing 10 replies - 1 through 10 (of 10 total)
  • Hi. Same problem here. Would appreciate very much your help.

    I have the same problem, wp-pagenavi 2.82 , wp 3.3.2

    Hi gus, did any of you manage to fix this? I’m having exactly the same problem.

    Heres my code:

    					$the_query = new WP_Query(
    							'posts_per_page' => '3',
    							'paged' => get_query_var('paged'),
    							'category_name' => 'revista-matiz'
    					if($the_query->have_posts()) : while ($the_query->have_posts()) : $the_query->the_post();
    			<div id="contenedor-matiz">
    				<h1 class="titulo-post"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h1>
    				<?php the_post_thumbnail('revista-matiz-thumb'); ?>
    				<?php the_content('seguir leyendo'); ?>
    			</div><!-- /#contenedor-matiz -->
    			<?php endwhile; endif; ?>
    				wp_pagenavi( array('query' => $the_query ));

    Just like troya86 i’m using latest wordpress and wp pagenavi. My permalinks structure is /%category%/%postname%/

    Let’s find out what might be the problem!

    Exact same problem and permalink structure for me. Anyone solve?

    Same problem here, my code:

    <?php $paged = (get_query_var('page')) ? get_query_var('page') : 1; ?>
    <?php $work_items = new WP_Query(array( 'post_type' => 'work', 'posts_per_page' => '12', 'paged' => $paged ) ); ?>
    <?php while ($work_items->have_posts() ) : $work_items->the_post(); ?>
    <div class="col2 work-item">
        <a href="<?php the_permalink(); ?>">
            <img src="<?php the_field('work_overview_thumbnail'); ?>" alt="" />
            <p class="descr"><?php the_field('work_overview_description'); ?> <span><?php the_field('work_client_name'); ?></span></p>
    <?php endwhile; ?>
    <?php wp_pagenavi(array( 'query' => $work_items )); ?>

    Using get_query_var('page') cause it’s a custom page template as explained in this article. Using get_query_var('paged') doesn’t work either.

    My permalink structure is just /%postname%/

    Has anyone managed to fix this problem?

    Plugin Author scribu


    Folks, none of you have mentioned in which file you have placed that code.

    Hi Scribu, thanks for your reply!

    I use my code (above) in a custom page template (which is why I’m using get_query_var('page')). Think a portfolio page that I’m trying to display my Work CPT posts on.

    EDIT: I changed my code a bit with an exact copy/paste from your article I mentioned above:

    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

    but that doesn’t work either. I’m not sure I should be using get_query_var('page') or get_query_var('paged')

    Plugin Author scribu


    Regardless if you use ‘page’ or ‘paged’, you should not get a 404.

    It works fine for me, WP 3.3.2, same permalink structure. So, check elsewhere (possibly other active plugins or other theme code).

    I’m having the same problem after upgrading to 3.4 I get a ‘Page not found’ error whenever I click on a number or the ‘Next’ button. Yet on another site that I have that is also running 3.4 and the same plugin it works fine.

    This seems to happen in wordpress 3.4 if paginating custom post types.
    Check out this post
    It solved the problem for me.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Plugin: WP-PageNavi] wp-pagenavi throws error 404’ is closed to new replies.