I have a a multisite installation of wordpress. On my startpage (index.php) I show posts from all the sites that belongs to the network. The problem I'm experience is that when I go to /Page/2 I get a 404 message if my main blog doesn't have enough posts for a page 2. However on the whole network there are enough posts for 2 pages. If I add some more posts to my main blog, page 2 will be available again. My guess is that wordpress checks if any posts exists for the query before it includes index.php. I have tried to find where this could be done but have not found anything. Does anyone know if wordpress does this kind of check before index.php is included?

  • do you display any of the posts from the home page main query, are are you only showing the network posts?
    – Milo
    Nov 1, 2013 at 22:59
  • I show the most recent posts from across the network which is made by a custom query. The thing is that I never reach this query since it it inside index.php which for some reason doesn't get included. Instead 404.php seems to be included
    – Abris
    Nov 1, 2013 at 23:39

1 Answer 1


Every front end page request on a WordPress site produces a main query. The template that WordPress decides to load is based on the results of that main query (you can see the order that WordPress does these things by looking at the Action Reference page). Despite the fact that you never output the results of that query, it's still run, and in the case of paginated archives, this is an issue if you're trying to use that pagination for a different query.

The best case scenario is to modify the main query before it's run via the pre_get_posts action, however, this won't work for you because you're querying network posts, which, as far as I know, the WP_Query class can't do on its own.

The simplest solution to this is to make your landing page a static page instead of a posts archive. Create a new page under the Pages menu in admin, then visit Settings > Reading, and under Front page displays, select A static page, then choose that page from the dropdown menu. You'll now be able to paginate that page without it throwing a 404, because the main query will always contain just that single page's data and won't be potentially empty.

  • Brilliant answer! Made a new template for my start page and made a static page using this template. The pagination works like a charm now :)
    – Abris
    Nov 2, 2013 at 18:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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