Support » Plugin: Relevanssi - A Better Search » [Plugin: Relevanssi] Sorting 'oldest to latest' does not work

  • Resolved nhowarth


    I’m trying to give users to sort results as follows:

    <a href="<?php bloginfo('url');?>?s=<?php echo get_search_query();?>">Relevance</a>
    <a href="<?php bloginfo('url');?>?s=<?php echo get_search_query();?>&orderby=post_date&order=desc">Newest</a>
    <a href="<?php bloginfo('url');?>?s=<?php echo get_search_query();?>&orderby=post_date&order=asc">Oldest</a>

    Relevance and Newest work fine, but Oldest does not (it produces the same results as Newest).

    Any thoughts?

    Thanks in anticipation

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Mikko Saari


    I just tested this on my test blog and everything worked just fine. The results come out in correct order and switch order like they should when I change the order parameter.

    The function is a bit picky, as the parameter must be exactly “asc” for it to ascending sort, anything else (even ASC or something like that) and it’s a descending sort.

    So, I’m guessing that for some reason the parameter isn’t being passed as it should.

    You could try adding


    after line 952, which looks like this:

    isset($wp->query_vars["order"]) ? $order = $wp->query_vars["order"] : $order = 'desc';

    Then click the link with the ascending order and see what the var_dump says.

    Thanks Mikko for getting back to me so quickly.

    I added var_dump($order); as suggested and everything worked OK.

    I guess there must have been something in my cache that was causing the problem.

    Thanks for your help.


    Plugin Author Mikko Saari


    Good to hear you got it solved. Hope you like Relevanssi!

    It’s great Mikko,

    I have just completed installing it on my live site Cyprus Property News.



    Plugin Author Mikko Saari


    Very nice. Thanks for using Relevanssi!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Relevanssi] Sorting 'oldest to latest' does not work’ is closed to new replies.