Order by meta_key where meta_value is NUMBER (5 posts)

  1. Beee
    Posted 6 years ago #

    I thought I had this down, but it seems I didn't after all...

    I tried all options listed in the topic below, but no luck...

    I really would like to get this fixed... Would anybody know a way to do this ?

    it's used to show most read items on http://www.documentingstyle.com

  2. Beee
    Posted 6 years ago #

    and then suddenly it hit me.... I used


    which should be


    prob solved

  3. Beee
    Posted 6 years ago #

    $allowed_keys[] = 'meta_value_num';
    should be changed into
    $allowed_keys[] = 'meta_value_number';
    on line 2135 in /wp-includes/query.php for wordpress 3.0

    and on line 2160
    case 'meta_value_num':
    should be changed into
    case 'meta_value_number':

    seems to work again

  4. robertjakobson
    Posted 6 years ago #

    You shouldn´t change these values, rather one should use "num" instead of number while writing the query.

  5. humble coder
    Posted 5 years ago #

    Can someone give me a bit of info on this issue from the beginning? It seems like every answer to this type of question makes assumptions regarding one's knowledge of WP and starts too far into the process.

    Anyway, I'm having a similar issue, but I'm happy with the default layout of the posts. I simply want to allow users to click a link and reload a sorted page based on various meta_key fields (e.g. price, location, size). However, I'm not sure where to "short-circuit" the process in order to provide my own query. I provided what I thought was the proper URL -- it appears that "ASC/DESC" change the display based on entry date, but nothing about the "meta_key" seems to have any effect. Do I need to create a full categories.php or loop.php page manually or is there somewhere I can slip the query in?

    The following are some sample URLs:

    I'm honestly lost and am not sure where to go from here. Thoughts?

Topic Closed

This topic has been closed to new replies.

About this Topic