Issue:
random listings pagination is all over the place. places show up on multiple pages, if someone goes back to page 1 it’s a whole different listing. I’ve tried many approaches. My client needs this to work.
Request:
Have random lists cached for 5 minutes, either site-wide, or user based.
Considerations:
– needs to be upgrade friendly
– The site is hosted on WPengine and uses EverCache
I have made this work for regular posts on other sites before. Maybe a jumping off point.
session_start();
add_filter('posts_orderby', 'edit_posts_orderby');
function edit_posts_orderby($orderby_statement) {
$seed = $_SESSION['seed'];
if (empty($seed)) {
$seed = rand();
$_SESSION['seed'] = $seed;
}
$orderby_statement = 'RAND('.$seed.')';
return $orderby_statement;
}