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
    • 62
    • #1,837

    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

Join 368713 happy members

Get access to our entire collection of epic plugins, astonishing themes & genius support

Become a member