I have a custom page that uses a rewrite rule. The "non-pagination" rewrite works fine:


basically a url like this /pagename=brand-list&brand=MyBrand&section=MySection ends up like this, /brand-list/MyBrand/Mysection

However, when using pagination the page number is never returned to wordpress so $paged on page 2 is still 0


this url, /pagename=brand-list&brand=MyBrand&section=MySection&paged=2, ends up like this, /brand-list/MyBrand/Mysection/page/2 but still shows page 1. Checking the $paged value it outputs as 0, it should be 2.

If I removed the rewrite rules and /pagename=brand-list&brand=MyBrand&section=MySection&paged=2 is passed page 2 is shows and $paged value is 2.

With the rewrite rule in place, if you have over the page numbers you get this:


Obviously the rewrite rule is the problem but I'm not sure what part I'm missing.

If I use this url:


with the rewrite all it results in:


and works! but my url structure is incorrect.

----- edit ------

my current function

function rewrite_rule_brands() {
        global $wp_rewrite;
    add_action( 'init', 'rewrite_rule_brands' ); 
  • What order have you got these rules in? You should have your second rule the paged one first and then the other one second. Commented Aug 1, 2013 at 22:19
  • I got the same results... added an edit that shows my current function as is.
    – dcp3450
    Commented Aug 1, 2013 at 22:24

2 Answers 2


I changed:




Note the difference is /page/([0-9]+)? is now /page/?([0-9]{1,})/?$

seems to be working now.


This answer helped me thru a custom rewrite issue. I want to add that my case was a bit different in that I nested the category tree within the url structure
example.com/brand-list/brand-child-category/brand-grand-child-category/page/1 This would be like brand-list/nike/air-jordans/high-tops/postname

To get mine to work I had 1 call for the categories, then page, and finally the page number qualifier.

$newRules['brand-list/(.+)/page/?([0-9]{1,})/?$'] =

NOTE: my rewrite coding is different but the basic structure could help others.

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.