Support » Plugin: Advance WP Query Search Filter » Result page sort by meta key doesn't work

  • First, thank you for this lovely plugin! I am grateful to you for your work; it has been very helpful on this project.

    One thing I can’t seem to figure out. We are using two forms here:

    One is for string search (the one on the left with the label “Name includes”) and the other for three dropdown filters (language and specialty are taxonomies, and office is custom meta field). I have both forms set to use meta key “last_name” as value for sorting.

    Also, I am redirecting searches performed from these referrers to a custom search template. Other searches performed from elsewhere on the site go to a default search template.

    When a search is performed from the string search form, results are indeed displayed in ASC order by meta value ‘last_name’. However, this is not the case for the other search form; I’ve tried orderby various meta fields and always the result is default date value (posted-on date).

    I have tried customizing the query on the search template itself, but every variation of customized query (wp_query and query_posts) seems to override the search query and gives me all the posts. I am able to echo the ‘last_name’ meta value correctly on the search results loop, so it appears that that meta key is alive and present in the database.

    Any thoughts?

Viewing 1 replies (of 1 total)
  • Plugin Author TC.K


    Weird, can’t tell the reason why is this happened. Maybe it is because of conflict with other plugin.

    Unless you give me the wp_query object on the search query, other wise it is hard to tell what is going wrong.
    To get the wp_query object, simply print it in your custom search template, before the loop.

    global $wp_query;

Viewing 1 replies (of 1 total)
  • The topic ‘Result page sort by meta key doesn't work’ is closed to new replies.