Without pagination, WordPress loads all your posts onto a single page, which slows down load times and makes content harder to browse. Adding pagination splits your posts or content across multiple pages, giving visitors a cleaner experience and reducing the amount of data loaded at once.
There are four ways to add pagination in WordPress: through the built-in reading settings, by adding code to a theme template, by splitting a long post manually, or by installing a plugin. The method you choose depends on what you are paginating and how much control you need over the output.
yourdomain.co.uk/wp-admin.paginate_links() with the correct total and base arguments.WordPress includes a native setting that limits how many posts appear on your blog index and archive pages. Enabling this is the fastest way to add pagination without touching any code.

Your blog index and archive pages now display a fixed number of posts per page with navigation links generated automatically by your theme.
If your theme does not display pagination links, or you want to control exactly where they appear, you can add the the_posts_pagination() function directly to a template file. This function outputs a navigation block with previous and next links, and optionally numbered page links.
index.php, archive.php or category.php.endwhile; or the closing of a while ( have_posts() ) block.mid_size argument controls how many page numbers appear either side of the current page.<?php
the_posts_pagination( array(
'mid_size' => 2,
'prev_text' => __( '« Previous', 'textdomain' ),
'next_text' => __( 'Next »', 'textdomain' ),
) );
?>
Your theme template now outputs pagination links after the post loop. If you are working with a custom WP_Query rather than the main query, see the section below on paginating custom queries.
For long posts or pages, WordPress lets you insert manual page breaks using a special tag. Each break creates a new page within the same post, with navigation links added automatically.
<!--nextpage--> at each point in the content where you want a new page to begin.Content for the first page.
<!--nextpage-->
Content for the second page.
<!--nextpage-->
Content for the third page.
Visitors can now move through the post page by page. This approach works independently of your posts-per-page setting.
When you run a custom WP_Query, the main query pagination settings do not apply. You need to pass the total page count from your custom query directly to paginate_links(), along with a correctly formatted base URL.
Add the following code after your custom query loop, replacing $the_query with the variable name you used for your WP_Query object.
<?php
$big = 999999999; // An unlikely integer used as a placeholder in the base URL
echo paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var( 'paged' ) ),
'total' => $the_query->max_num_pages,
) );
?>
The base argument tells WordPress the URL pattern to use when generating page links. The total argument comes from your custom query so WordPress knows how many pages to generate.
Plugins are a good option if you want styled pagination without editing theme files. Most pagination plugins add a shortcode or widget you can drop into any template or page builder layout.
Your chosen plugin now controls the pagination output. You can return to its settings at any time to adjust the appearance.
If no pagination links show on your archive or blog pages, the most likely cause is that your theme does not call a pagination function, or the posts-per-page limit is set higher than your total post count.
the_posts_pagination() or paginate_links() after the post loop.A 404 on paginated URLs usually means your permalink structure needs refreshing. WordPress caches rewrite rules, and stale rules can break paged URLs.
base and format arguments in your paginate_links() call match your permalink structure.This is a common issue with custom queries. When the paged query variable is not passed to your WP_Query, WordPress always loads page 1 regardless of the URL.
'paged' => get_query_var( 'paged' ).total argument in paginate_links() references $your_query->max_num_pages and not a hardcoded number.You now have four ways to add pagination to your WordPress site: the built-in reading settings for standard blog archives, direct theme code for custom templates, the <!--nextpage--> tag for splitting individual posts, and a plugin for styled output without code changes. Custom queries require the additional step of passing the correct total and base values to paginate_links().
Once pagination is working, review your site’s overall performance. Faster page loads improve the experience for visitors moving between pages. See our guides on increasing the WordPress memory limit and optimising WordPress images with AVIF for related improvements. You may also find the guide to WordPress caching useful for reducing load times on paginated archives.
Our WordPress hosting plans are configured to support WordPress permalink structures and custom query pagination out of the box.
Get fast, secure and reliable WordPress Hosting with optimised for performance with AccelerateWP.
Get WordPress HostingCreate fully isolated individual accounts for your clients and manage them all from one dashboard.
Get Reseller Hosting