Introduction
If you’ve worked with WordPress long enough, you’ve probably noticed how pagination works for categories, archives, or product listings. For example, page one of a product category might show up like this:
https://example.com/product-category/can/page/1/But realistically, the first page doesn’t need /page/1/ at all. Instead, the cleaner and canonical URL should be:
https://example.com/product-category/can/That tiny difference can have big consequences for SEO and user experience. Luckily, with just a simple snippet of code, you can clean this up once and for all.
Why “/page/1/” Is a Problem
At first glance, there’s nothing wrong with /page/1/—it still loads fine. But for search engines:
- Duplicate Content Risk:
/page/1/and/display the same content. - Link Equity Split: Backlinks could end up pointing to different versions of the same page.
- User Experience: URLs look longer and less tidy than they need to be.
Search engines prefer concise, canonical links. So cleaning this up keeps your site’s SEO sharp and professional.
The Fix: WordPress Filter Snippet
Here’s the exact piece of code that will strip /page/1/ from your pagination links:
function custom_paginate_links_base_url( $link ) {
// Check if the URL is for page 1 and change it to the base URL
if ( strpos( $link, '/page/1/' ) !== false ) {
$link = preg_replace( '/\/page\/1\//', '/', $link );
}
return $link;
}
add_filter( 'paginate_links', 'custom_paginate_links_base_url' );How It Works
Let’s break this down in plain English:
add_filter( 'paginate_links', ... )→ Hooks into the WordPress function that builds pagination links.strposcheck → Looks for any URL containing/page/1/.preg_replacemagic → If found, it replaces/page/1/with just/.- Final result → Clean pagination where page one is always the canonical base URL.
So instead of links like:
https://example.com/product-category/can/page/1/You’ll now get the much friendlier:
https://example.com/product-category/can/
Benefits of Using This Snippet
✅ SEO Friendly – Avoids duplicate content issues with search engines.
✅ Cleaner URLs – Easier on the eyes, more professional.
✅ Consolidated Rankings – Backlinks and authority concentrate on one URL.
✅ Performance-Safe – Just a tiny filter function, no heavy plugin required.
Step-by-Step Guide to Apply It
- Backup your site (always the safe move).
- Open your theme’s
functions.phpfile (or better, a child theme/plugin file). - Paste in the code snippet above.
- Save and clear your cache.
- Visit your category pages and click through pagination links.
✨ Voilà—page one URLs are now beautifully clean.
Recommended Image for This Blog
Since your readers might be developers, marketers, or store owners, pick something that communicates “SEO + Clean URLs”. Here are a few easy options:
- Illustration of a “messy URL” (
/page/1/…) being transformed into a “clean URL” (/). - A browser window graphic with a checkmark next to the tidy version.
- An SEO symbol (magnifying glass or search icon) over a clean URL bar.
You can make a simple visual quickly using Canva or Figma with text like “/page/1/ → /”.
Conclusion
Fixing /page/1/ URLs in WordPress might feel like a small tweak, but these micro-optimizations add up over time. Cleaner URLs mean search engines understand your site better, users trust it more, and your online presence looks professional.
With just a few lines of code, you’ve now decluttered your pagination, boosted SEO, and streamlined your site. Think of it as giving your URLs a fresh haircut—shorter, sharper, and a whole lot cooler.