WordPress GuidePost → Pagination

How to add WordPress pagination

Woman Coding on Computer

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:

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:

1. Default WordPress pagination (what you get out of the box)

Most themes use the WordPress loop with built-in pagination. Common functions include:

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.

3. Use a pagination plugin (no coding required)

If your theme lacks pagination or you want more control, use a plugin.

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:

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:

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:

This approach offers full control over markup, animations, and behavior—but it requires solid knowledge of both PHP and JavaScript.

Ready to get started?

Get the fastest, most secure WordPress.org hosting on the market.

Trust us to help you choose the ideal hosting solution

Loading form…