Sorting order in Wordpress with advance custom field

So I have a ACF called 'track_number' in order to sort each song (CPT) on the album pages (based on their taxonomy).

On the album page I run this loop to get the songs:

And for the most part I get what I expected minus one problem, the double digit numbers are jumping ahead (1,10,11,2,3...).

I tried to just put '0' in front of all the single digit fields but it didn't work. Ultimately I'd like to resolve it as is anyways. Any ideas?


    Hopefully one of our more experienced coding members will have some advice :)


    Hiya, try using meta_value_num as the orderby parameter. Thx.

    Div Truth
    • Elite
    • 87
    • #1,474

    Genius Mason, per genius, thanks so much that was so simply (facepalm)


    I get an occasional one or two right :) Glad we were able to help


We pride ourselves on our level of customer support and responsiveness to member requests. Your WordPress experience will never be the same

Become a member

  • PayPal Partner