◦ Comprehensive security
◦ 24/7 support
WordPress Guide → Post → Pagination
How to add WordPress pagination
If users can’t find your older posts, product pages, or content archives, they’re not going to stick around for long. Pagination is a simple, powerful tool for improving site navigation, keeping users engaged, and boosting SEO.
Let’s walk through all the ways you can add, customize, and manage pagination in WordPress—from default tools to advanced options.
Get fast, reliable hosting for WordPress
Power your site with the industry’s fastest, most optimized WordPress hosting
What is pagination in WordPress?
Pagination breaks large sets of content into smaller chunks across multiple pages. In WordPress, you’ll usually see it in post archives, blog listings, search results, or product category pages.
There are several types of pagination:
- Numeric pagination (1, 2, 3…)
- Previous/Next links
- Load more buttons
- Infinite scroll (automatically loads new content when you scroll down)
WordPress supports pagination out of the box, but you can customize it to fit your layout, performance goals, or user experience needs.
Why use pagination on your WordPress site?
Pagination isn’t just for design—it improves:
- User experience. Readers can browse older posts without endless scrolling.
- Page load times. Fewer posts per page means faster performance.
- SEO. Proper pagination helps search engines index your content more effectively.
- Engagement. More pages mean more clicks, which can reduce bounce rate.
1. Default WordPress pagination (what you get out of the box)
Most themes use the WordPress loop with built-in pagination. Common functions include:
- the_posts_pagination() – Generates numbered page links.
- posts_nav_link() – Simpler next/previous navigation.
You’ll usually find these functions in index.php, archive.php, or search.php. However, not all themes style or position pagination well.
Twenty Twenty-Four and other block-based themes may rely on built-in blocks like Query Loop, which includes pagination options without custom code.
2. Pagination options inside your WordPress theme
WordPress gives you several built-in functions to control pagination inside your theme templates. These options are flexible enough for most archive and blog layouts, especially if you’re comfortable working with theme files or child themes.
Use the_posts_pagination() or paginate_links()
To add pagination in a theme file:
the_posts_pagination(array(
‘mid_size’ => 2,
‘prev_text’ => __(‘« Previous’, ‘textdomain’),
‘next_text’ => __(‘Next »’, ‘textdomain’),
));
Or use paginate_links() if you’re working with a custom loop:
$big = 999999999; // need an unlikely integer
echo paginate_links(array(
‘base’ => str_replace($big, ‘%#%’, esc_url(get_pagenum_link($big))),
‘format’ => ‘?paged=%#%’,
‘current’ => max(1, get_query_var(‘paged’)),
‘total’ => $custom_query->max_num_pages
));
Make sure your custom WP_Query uses the paged parameter and that your main loop respects query vars.
Add pagination to single posts (multi-page articles)
To split a long article into multiple pages:
- In the block or classic editor, insert <!–nextpage–> where you want a page break.
- Add this to single.php to show navigation:
wp_link_pages(array( - ‘before’ => ‘<div class=”page-links”>Pages:’,
- ‘after’ => ‘</div>’,
- ));
This method is great for tutorials or long-form content.
3. Use a pagination plugin (no coding required)
If your theme lacks pagination or you want more control, use a plugin.
- WP-PageNavi: Adds customizable numeric pagination.
- Pagination by BestWebSoft: Supports archives, categories, and search results.
- Ajax Load More: Adds infinite scroll or “load more” buttons.
- WP-Paginate: Lightweight and easy to style.
These plugins often include settings panels and shortcode options, making them beginner-friendly.
Add custom pagination to a custom loop
For advanced users using WP_Query, here’s how to build custom pagination:
- Set up the query:
$paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
$args = array(
‘post_type’ => ‘post’,
‘posts_per_page’ => 6,
‘paged’ => $paged
);
$custom_query = new WP_Query($args); - Loop through posts:
if ($custom_query->have_posts()) :
while ($custom_query->have_posts()) :
$custom_query->the_post();
// Your content here
endwhile; - Add pagination:
echo paginate_links(array(
‘total’ => $custom_query->max_num_pages
)); - Reset post data:
wp_reset_postdata();
How to style pagination with CSS
WordPress adds classes to pagination elements that make them easy to target with CSS.
.page-numbers {
display: inline-block;
margin: 0 5px;
padding: 8px 12px;
border: 1px solid #ccc;
text-decoration: none;
}
.page-numbers.current {
background: #000;
color: #fff;
}
.page-numbers:hover {
background: #f2f2f2;
}
Flexbox or grid can be used to center or align pagination links.
Common pagination issues and how to fix them
Pagination returns 404: This usually happens when WordPress rewrite rules aren’t updated after changes to permalinks or custom queries. To fix this, go to Settings > Permalinks and click Save Changes. This refreshes your site’s permalink structure without needing to make edits.
Pagination not working in custom loops: If your pagination always shows the same content or links don’t change the page, you might be using the wrong query variable. Ensure you’re using the paged parameter (not page) in your custom WP_Query, and that you’re passing the correct current page value using get_query_var(‘paged’).
No styles or ugly layout: Some themes don’t include styles for pagination elements, or plugins output unstyled HTML. You can fix this by targeting .page-numbers, .pagination, or plugin-specific classes with your own CSS to create spacing, active states, and hover effects.
Duplicate content concerns: Search engines may treat paginated pages as duplicate content if canonical tags are missing. To fix this, make sure your theme or SEO plugin (like Yoast or Rank Math) adds rel=”next” and rel=”prev” links and proper canonical URLs to paginated archives.
Advanced pagination: load more buttons with AJAX
“Load more” buttons are a modern alternative to traditional pagination, offering a smoother user experience by loading additional content on the same page without a full page refresh. Instead of navigating to page 2 or 3, users simply click a button that loads more posts inline.
This technique is especially useful for portfolios, product catalogs, or blogs that want to keep users scrolling without breaking context.
Use a plugin to add load more functionality
The easiest option is to use a plugin like Ajax Load More. It lets you:
- Build infinite scroll or load more experiences with shortcodes or blocks.
- Control post types, filters, and load triggers.
- Load more content using AJAX without touching code.
Create a custom AJAX load more solution (for developers)
If you’re building a custom theme or need more control, you can create your own load more functionality using WordPress AJAX and JavaScript:
- Create a custom WP_Query in your template for the initial post load.
- Add a “Load More” button below the query results with a unique ID.
- Use JavaScript/jQuery to listen for clicks on the button and send an AJAX request to admin-ajax.php.
- Register a custom action hook in your functions.php to return the next batch of posts.
- Append the returned HTML to the current post list on success.
This approach offers full control over markup, animations, and behavior—but it requires solid knowledge of both PHP and JavaScript.
Getting started with WordPress pagination
Pagination makes your site easier to browse, faster to load, and better for SEO—when implemented correctly. Whether you’re using default settings, plugins, or custom code, there’s a solution for every site type.
Start by reviewing what your current theme offers. If it’s not flexible or doesn’t match your vision, plugins or custom code can give you total control over your pagination.
Ready to upgrade your WordPress experience? Professional hosting improves speeds, security, and reliability for a website and a brand that people find engaging and trustworthy. Liquid Web’s WordPress hosting options configure business-class servers and support plans specifically for WordPress websites.
Don’t want to deal with server management and maintenance? Our fully managed hosting for WordPress is the best in the industry. Our team are not only server IT experts, but WordPress hosting experts as well. Your server couldn’t be in better hands.
Click through below to explore all of our hosting for WordPress options, or chat with a WordPress expert right now to get answers and advice.
Additional resources
What is WordPress? →
A complete beginner’s guide to WordPress.org
What is a WordPress tag: Demystifying WordPress categories, tags, and more →
A quick guide to using tags in WordPress posts to improve content organization and discoverability.
Beginner’s Guide to WordPress themes →
Learn how they work, what to look for, how to choose, and more