WP_Query pagination using only numbers instead of /page/1 on URL

I didn’t really solve it, but got around with the help of Passing custom args in paginate_links and Custom paging function.

Initially I even thought of writing a patch to next_posts_link, but as it turns out, the URL formatting problem lies way below in the function soup, and that is really a downer when all I wanted was to reuse some earlier code that went into this template when it was still static.

My solution for now was to leave it all behind and start fresh with paginate_links(). Turns out that paginate_links doesn’t care about permalink structure and always appends ?page=4 to the URL which just makes a lot more sense. 🙂

UPDATE:
Followinfg along, I got this problem -> paginate_links() adds empty href to first page and previous link which was properly solved after all. 🙂

Leave a Comment

tech