My posts pagination in not working in WordPress 5.5 and So, I want to rewrite the URL for the pagination. I am using posts with pagination in the inner page with slug "post".

Current URL (The Pagination): domain.com/blog/2

I want to change the URL to: domain.com/blog/page/2

By changing the URL, the posts pagination start working. I added the jQuery code and the pagination is working but how I can do that in WordPress.

My code added in functions.php:

function my_pagination_rewrite() {
    add_rewrite_rule('blog/page/?([0-9]{1,})/?$', 'index.php?page=blog&paged=$matches[1]', 'top');
add_action('init', 'my_pagination_rewrite');

But this is not working.

I also tried the code using jQuery and it is working:

    jQuery('.elementor-pagination').find('a').each(function() {
    var url=jQuery(this).attr('href');
    var pieces = url.split("/");
    var newhrf =window.location.origin+'/blog/page/'+pieces[4];

The jQuery code ia working but my code in functions.php is not working.

Any help is much appreciated.

1 Answer 1


Seems to be related to: WordPress stripping out "page" query parameter with 301 redirect.

See Make WordPress Core ticket 50976:

"We understand that it may be annoying for themes and plugins authors to fix their usage of this variable, but it would introduce a way more issues if it was changed on WordPress Core side. It's objectively better to get this fixed on plugins and themes since it is a wrong usage of WordPress variables.

Closing this as wontfix, as the issue shouldn't be fixed on WordPress core but rather on plugins and themes side."

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.