Pagination issues with WordPress 5.5 and Elementor post widget​

A recent update with WordPress 5.5 caused the pagination in the post widget in elementor to break. 

URLS are displaying /2/ instead of /page/2/

A quick solution is to use Javascript to add the /page into the url.

 

1.Use the html widget

On the page where the problem is occuring, use the html widget.

2. Copy and paste the following code

<script>

jQuery(document).ready(function(){ 
    
   jQuery('a.page-numbers').each(function(index) { 
    
   var oldUrl = jQuery(this).attr('href'); 
  // alert("test: "+oldUrl);
   var patt = /\/[0-9]\//;
   var result = oldUrl.match(patt);
   var result2 = '/page' +result;
   
   url = oldUrl.replace(result, result2);


    jQuery(this).attr('href', url); }); 
    
});

</script>


How to debug

If you run into any problems, uncomment the line (remove the double forward slashes).

  // alert("test: "+oldUrl);

You can replace the +oldUrl variable with other variables to see what results appear.

Other solutions

You can find more solutions on github

Scroll to Top