Forums Forums Search & Filter Pro sort results in random order carry over on multiple pages

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Anonymous
    #45863

    I have selected to default sort the results of a search in ‘random’ order.
    The issue is when I have multiple page results the page re-randomises it on reload so some results are show multiple times and some not at all. I understand this is a wordpress query issue.
    I have found some code that should work, by storing the value in a session seed() however, it stops the randomisation completely.
    This is my code:
    session_start();
    add_filter(‘posts_orderby’, ‘edit_posts_orderby’);
    function edit_posts_orderby($orderby_statement) {
    if( !is_admin() ) {
    $seed = $_SESSION[‘seed’];
    if (empty($seed)) {
    $seed = rand();
    $_SESSION[‘seed’] = $seed;
    }
    $orderby_statement = ‘RAND(‘.$seed.’)’;
    }
    return $orderby_statement;
    }
    How can I get it to work with this plugin?
    Thanks

    Trevor
    #45881

    Hi Rena

    This appears to be a duplicate of this thread:

    https://support.searchandfilter.com/forums/search/search_filter_update_post_cache/

    Ross has been away and is slowly working his way through outstanding threads. Please give him a few days to get back to you.

Viewing 2 posts - 1 through 2 (of 2 total)