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 upgraded to WordPress 3.4 and am having an issues with showing a different amount of post on the first page versus the rest. The first page is still showing 5 posts but when I go to /page/2/ I'm getting a 404 error.

I have pagination on the custom post type pages and author pages and it works just fine. This is only happening on the front page with the combination of all post types together.

Here is my code that may help:

// For adding custom post types to the feed
if ( ( is_front_page() && false == $query->query_vars['suppress_filters'] ) || is_feed() ){
        $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
        query_posts( array('post_type'=>array('post', 'gaming', 'entertainment', 'tech', 'breakroom', 'podcasts', 'off-grid'),'paged'=>$paged ) );

// different amount of post on front page then other pages
            $temp = $wp_query;
            $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
            $wp_query = null;
            $wp_query = new WP_Query();
              'post_type' => array('post', 'gaming', 'entertainment', 'tech', 'breakroom', 'podcasts', 'off-grid'),
              'post_status' => 'publish',
              'paged' => $paged,
              'posts_per_page' => 10,
              'caller_get_posts'=> 1.

            $max_first_page = 5;  // Show this many posts on front page
            $args = $wp_query->query;
            $posts_per_page = get_query_var('posts_per_page');
            $posts_to_skip = $posts_per_page - $max_first_page;
            if ($paged == 1) {
               $max_posts = $max_first_page;
         $firstPageCheck = "yes";
        } else {
               $max_posts = $posts_per_page;
               $args['offset'] = (($paged - 1) * $max_posts)- $posts_to_skip;
         $firstPageCheck = "no";
            if ($wp_query->max_num_pages < ceil(($wp_query->found_posts + $posts_to_skip)/$posts_per_page))
            $counter = 0;

            if ($firstPageCheck == "yes") {
              // front page here
            } else {
              // all other pages
share|improve this question
Have you flushed your permalinks since the update? Go to Settings &raquo; Permalinks and then try to go back to /page/2/. – EAMann Jun 14 '12 at 23:20
Yes, I tried that before I asked this and I also tried rebooting nginx for the hell of it. Still no dice. – kel Jun 15 '12 at 0:32
up vote 3 down vote accepted

It stopped to work with WP 3.4 because there was fixes to handle_404(), and You are using wrong way on homepage... instead of creating new query, modify main query.

Changeset: http://core.trac.wordpress.org/changeset/19892

Sample code:

function my_query_for_homepage( $query ) {
    if( $query->is_main_query() && $query->is_home() ) {
        $query->set( 'post_type', array( 'post', 'gaming', 'entertainment', 'tech', 'breakroom', 'podcasts', 'off-grid' ) );
add_action( 'pre_get_posts', 'my_query_for_homepage' );
share|improve this answer
Can you give me a little more? How am I supposed to do the second page if it's going to 404 with paged? I'm willing to set this up as a bounty and give you the points! – kel Jun 18 '12 at 20:48
I didn't realize it was as simple as adding that to my functions.php. I thought I would have to modify more. Thanks for the help. – kel Jun 22 '12 at 1:55

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.