Forum: F.A.Q

This forum is closed for new topics. However, you can still search for a solution in the old topics. For technical support and general questions related to GEO my WP plugin and its core add-ons please use the support forum.

order results by custom field

Forums F.A.Q order results by custom field

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #33877


    I have a custom results page which displays a few custom fields. One of these shows a ‘level’ that the post is at.

    I need edit the results.php template so that the results are ordered by this field – For example if the field name is ‘wpcf_status’ with possible values 1,2,3 or 4 how can I order the results so any with the value ‘1’ are displayed higher than those with value ‘2’?

    Many thanks



    Hi Chris,
    You can use the filter gmw_pt_location_query_clauses which fires just before the search query to change the orderby clause. You can test the code below by changing the meta_key “test” to the meta key you want to use and add the code to your functions.php file.

    let me know if it helps.

    Thank you


    That seems to work – many thanks indeed.


    You are very welcome.


    Hi there! This function doesn’t seem to work anymore…

    Can someone tell me if I’m doing something wrong??


    Hello @kbleck,

    What exactly are you trying to accomplish?

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

You must be logged in to reply to this topic.