Numerical pagination behaving poorly in WordPress


Using the approach outlined here (, and I noticed a few issues with the default behavior.

Issue 01:
When only two pages are produced in the pagination sequence, when you click the second page (2), you will see the class=“active” still attached to the first page (1). However, it appears to function properly in another instance ( where only 2 “pages” exist – any idea(s) why?

Issue 02:
If a page has > 4 “pages”, when viewing page 5 in the source example, the pagination link for “page” 2 disappears, which I believe should of been replaced by a “…”.

Hope someone out there can shed a little light on this. To eliminate clutter in this question, I’ve created a pastebin ( with the PHP that operates the pagination in question.


I found help through another community, thanks anyway.