When we change the order of Posts to Random we do it easily and it works like a charm, but when we create pagination for those post…
…it got a mess because when we click to see the second page, it shows some previous random posts result and other posts too.
But, It is not the thing that you and we want.
We have written a custom function that will help you to easily randomize posts order and retain persistent pagination.
Follow the below guide:
Display Posts Random Order with Retain Persistent Pagination
First of all, copy the below code and paste it into your WordPress theme’s functions.php file.
Code Snippets for Random Posts with Persistent Pagination
Save the file and check the result in your browser.
Hope the above code worked smoothly in your project.
Let us know if you have any questions or opinion about this post in the comment section.
Don’t forget to share this Display Posts Randomly with Pagination.