• I’m sorting a list of posts by using a simple url format:

    ?orderby=title&orderby=post_parent&order=ASC
    at the end of my main page, which would normally just list of posts by date posted.

    The above works perfect. Also, the previous and next work along with that perfectly.

    However, when I try to use meta data fields, it doesn’t work:

    ?meta_key=_count-views_all&orderby=meta_value_num&order=DESC
    It doesn’t actually sort by the count views listed in the database.

    I’ve looked at the all the numbers and I actually can’t figure out how it’s sorting, because it’s different than the regular link without the parameters.

    Any ideas on why this is happening?

    Thanks!!!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Presume you’ve checked/know that this is the correct meta_key name – _count-views_all?

    If so try ‘orderby’ => ‘meta_value meta_value_num’ – Think it depends on how the data is stored DB side.

    I’ve looked at the all the numbers and I actually can’t figure out how it’s sorting, because it’s different than the regular link without the parameters.

    — Probably only listening to the DESC

    Thread Starter lara_19800

    (@lara_19800)

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Sort by Meta fields using URL’ is closed to new replies.