WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

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 load 10 posts on my home.php and I have the 'posts_nav_link()' function to acces to latest entries. But when I click on the previous entries, the link redirect me to mysite.com/page/2 and give me a 404 error.

Could you help me please Thanks ?

<?php if (have_posts()) : 
                            'post_type' => array(

                <?php while (have_posts()) :
                    the_post(); ?>

                <div class="box1 clearfix" style="margin-top: 7px;">
                    <div class="post clearfix">
                        <h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
                        <p class="txt0"><?php the_time('d F Y'); ?> dans <a href="<?php echo site_url(get_post_type());?>"><?php echo get_post_type(); ?></a> // <?php comments_popup_link(__('No Comments &#187;', woothemes), __('1 Comment &#187;',woothemes), __('% Comments &#187;',woothemes)); ?></p>

                    <?php the_content(__('<span class="continue">Continue Reading</span>',woothemes)) ?>


                <?php endwhile; ?>

                <div class="navigation nav clearfix">
                    <div class="fl"><?php posts_nav_link() ?></div>
share|improve this question
We need more info. Can you show us the code that you are using for your home page? Also, double-check your permalink settings and try saving them again. – Joseph Leedy Jul 2 '12 at 20:53
The posts_nav_link() redirect me to localhost/mysite/page/2 and give me a 404 error. – Zaidar Jul 2 '12 at 20:57
up vote 3 down vote accepted

Never use query_posts() :). See this answer for more detailed explanation of why not, and the alternatives.

In this instance, remove your query_posts() and instead in a plug-in, (or functions php).

function wpse57229_change_query_for_main_page( $query ){
     if( $query->is_main_query() && is_front_page() ){
share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.