Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Beee

    (@beee)

    and then suddenly it hit me…. I used

    orderby=meta_value_num

    which should be

    orderby=meta_value_number

    prob solved

    Thread Starter Beee

    (@beee)

    $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

    Robert

    (@robertjakobson)

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

    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:
    cat=9&meta_key=_features_1_col1_1&orderby=meta_value&order=ASC
    cat=9&meta_key=_features_1_col1_1&orderby=meta_value_num&order=DESC

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Order by meta_key where meta_value is NUMBER’ is closed to new replies.